Skip to content

Commit

Permalink
🎨 Format
Browse files Browse the repository at this point in the history
  • Loading branch information
harehare committed Aug 4, 2023
1 parent c6d76db commit 1a0af44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 0 additions & 2 deletions frontend/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ module.exports = {
useTabs: false,
tabWidth: 2,
trailingComma:"es5",
importOrder: ['^[.]+$', '^[./]'],
importOrderSeparation: true,
};
19 changes: 11 additions & 8 deletions frontend/src/ts/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ export const signOut = async (): Promise<void> =>
});

export const pollRefreshToken = (callback: (idToken: string) => void): void => {
setInterval(async () => {
const user = auth.currentUser;
if (user) {
const idToken = await user.getIdToken(true).catch(() => false);
if (idToken && typeof idToken === 'string') {
callback(idToken);
setInterval(
async () => {
const user = auth.currentUser;
if (user) {
const idToken = await user.getIdToken(true).catch(() => false);
if (idToken && typeof idToken === 'string') {
callback(idToken);
}
}
}
}, 10 * 60 * 1000);
},
10 * 60 * 1000
);
};

export const refreshToken = (): Promise<string> | undefined => auth.currentUser?.getIdToken(true);
Expand Down

0 comments on commit 1a0af44

Please sign in to comment.