fix: reduce the number of API requests when changing route (#14666)

* fix: reduce the number of API requests when changing route

* fix: reset `userInteraction` after sign out
This commit is contained in:
martin
2024-12-16 15:45:01 +01:00
committed by GitHub
parent 6b0f9ec46c
commit 8945a5d862
9 changed files with 63 additions and 20 deletions

View File

@@ -2,8 +2,8 @@ import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { foldersStore } from '$lib/stores/folders.svelte';
import { purchaseStore } from '$lib/stores/purchase.store';
import { serverInfo } from '$lib/stores/server-info.store';
import { preferences as preferences$, resetSavedUser, user as user$ } from '$lib/stores/user.store';
import { resetUserInteraction, userInteraction } from '$lib/stores/user.svelte';
import { getAboutInfo, getMyPreferences, getMyUser, getStorage } from '@immich/sdk';
import { redirect } from '@sveltejs/kit';
import { DateTime } from 'luxon';
@@ -72,7 +72,7 @@ export const authenticate = async (options?: AuthOptions) => {
export const requestServerInfo = async () => {
if (get(user$)) {
const data = await getStorage();
serverInfo.set(data);
userInteraction.serverInfo = data;
}
};
@@ -99,6 +99,7 @@ export const handleLogout = async (redirectUri: string) => {
}
} finally {
resetSavedUser();
resetUserInteraction();
foldersStore.clearCache();
}
};