mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat(auth): implement JWT token refresh mechanism
This commit is contained in:
+2
-1
@@ -27,8 +27,9 @@ function parseJwtExp(token: string): number | null {
|
||||
}
|
||||
}
|
||||
|
||||
let refreshPromise: Promise<string> | null = null
|
||||
|
||||
export const createAuthFetcher = (auth: AgentAuthContext): AuthFetcher => {
|
||||
let refreshPromise: Promise<string> | null = null
|
||||
return async (url: string, options?: RequestInit) => {
|
||||
if (auth.bearer) {
|
||||
const exp = parseJwtExp(auth.bearer)
|
||||
|
||||
Reference in New Issue
Block a user