fix and update
This commit is contained in:
@@ -494,6 +494,19 @@ export async function refreshAuthSession(): Promise<RefreshSessionResponse> {
|
||||
return response.json() as Promise<RefreshSessionResponse>;
|
||||
}
|
||||
|
||||
export async function syncFedcmSession(accessToken: string) {
|
||||
if (typeof window === 'undefined' || !accessToken.trim()) return;
|
||||
try {
|
||||
await fetch(`${getApiUrl()}/fedcm/session/sync`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${accessToken.trim()}` },
|
||||
credentials: 'include'
|
||||
});
|
||||
} catch {
|
||||
// фоновая синхронизация FedCM cookie
|
||||
}
|
||||
}
|
||||
|
||||
async function trySilentTokenRefresh(): Promise<RefreshSessionResponse | null> {
|
||||
try {
|
||||
const refreshed = await refreshAuthSession();
|
||||
|
||||
Reference in New Issue
Block a user