mirror of
https://github.com/directus/directus.git
synced 2026-01-23 08:08:04 -05:00
Fix auth token refresh to be on first load only (#8204)
This commit is contained in:
@@ -62,12 +62,15 @@ export const router = createRouter({
|
||||
routes: defaultRoutes,
|
||||
});
|
||||
|
||||
let firstLoad = true;
|
||||
|
||||
export const onBeforeEach: NavigationGuard = async (to, from) => {
|
||||
const appStore = useAppStore();
|
||||
const serverStore = useServerStore();
|
||||
|
||||
// First load
|
||||
if (from.name === undefined) {
|
||||
if (firstLoad) {
|
||||
firstLoad = false;
|
||||
// Try retrieving a fresh access token on first load
|
||||
try {
|
||||
await refresh({ navigate: false });
|
||||
|
||||
Reference in New Issue
Block a user