added post modal for feed on map
This commit is contained in:
@@ -22,6 +22,11 @@ function clearTokens() {
|
||||
|
||||
let refreshPromise = null;
|
||||
|
||||
let onSessionExpired = null;
|
||||
export function setOnSessionExpired(cb) {
|
||||
onSessionExpired = cb;
|
||||
}
|
||||
|
||||
export async function refreshAccessToken() {
|
||||
if (refreshPromise) return refreshPromise;
|
||||
|
||||
@@ -73,6 +78,7 @@ export async function apiFetch(url, options = {}) {
|
||||
res = await doFetch(newToken);
|
||||
} catch {
|
||||
clearTokens();
|
||||
if (onSessionExpired) onSessionExpired();
|
||||
throw new Error("Session expired");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user