mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
fix: token refresh locking (#613)
* fix: kv use tls explicit * fix: token refresh locking * remove logs * compile fix * compile fix --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
@@ -8,10 +8,11 @@ import { assertCustomSession, CustomSession } from "./types";
|
||||
import { Session } from "next-auth";
|
||||
import { SessionAutoRefresh } from "./SessionAutoRefresh";
|
||||
import { REFRESH_ACCESS_TOKEN_ERROR } from "./auth";
|
||||
import { assertExists } from "./utils";
|
||||
|
||||
type AuthContextType = (
|
||||
| { status: "loading" }
|
||||
| { status: "refreshing" }
|
||||
| { status: "refreshing"; user: CustomSession["user"] }
|
||||
| { status: "unauthenticated"; error?: string }
|
||||
| {
|
||||
status: "authenticated";
|
||||
@@ -41,7 +42,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
return { status };
|
||||
}
|
||||
case true: {
|
||||
return { status: "refreshing" as const };
|
||||
return {
|
||||
status: "refreshing" as const,
|
||||
user: assertExists(customSession).user,
|
||||
};
|
||||
}
|
||||
default: {
|
||||
const _: never = sessionIsHere;
|
||||
|
||||
Reference in New Issue
Block a user