mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(web): logout of all tabs (#12407)
This commit is contained in:
parent
0dabb890cf
commit
2554cc96b0
9 changed files with 73 additions and 25 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import { browser } from '$app/environment';
|
||||
import { goto } from '$app/navigation';
|
||||
import { foldersStore } from '$lib/stores/folders.store';
|
||||
import { purchaseStore } from '$lib/stores/purchase.store';
|
||||
import { serverInfo } from '$lib/stores/server-info.store';
|
||||
import { preferences as preferences$, user as user$ } from '$lib/stores/user.store';
|
||||
import { preferences as preferences$, resetSavedUser, user as user$ } from '$lib/stores/user.store';
|
||||
import { getAboutInfo, getMyPreferences, getMyUser, getStorage } from '@immich/sdk';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { DateTime } from 'luxon';
|
||||
|
|
@ -87,3 +89,16 @@ export const getAccountAge = (): number => {
|
|||
|
||||
return Number(accountAge);
|
||||
};
|
||||
|
||||
export const handleLogout = async (redirectUri: string) => {
|
||||
try {
|
||||
if (redirectUri.startsWith('/')) {
|
||||
await goto(redirectUri);
|
||||
} else {
|
||||
window.location.href = redirectUri;
|
||||
}
|
||||
} finally {
|
||||
resetSavedUser();
|
||||
foldersStore.clearCache();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue