mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 17:25:11 +03:00
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:
@@ -1,4 +0,0 @@
|
||||
import type { ServerStorageResponseDto } from '@immich/sdk';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const serverInfo = writable<ServerStorageResponseDto>();
|
||||
26
web/src/lib/stores/user.svelte.ts
Normal file
26
web/src/lib/stores/user.svelte.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
AlbumResponseDto,
|
||||
ServerAboutResponseDto,
|
||||
ServerStorageResponseDto,
|
||||
ServerVersionHistoryResponseDto,
|
||||
} from '@immich/sdk';
|
||||
|
||||
interface UserInteractions {
|
||||
recentAlbums?: AlbumResponseDto[];
|
||||
versions?: ServerVersionHistoryResponseDto[];
|
||||
aboutInfo?: ServerAboutResponseDto;
|
||||
serverInfo?: ServerStorageResponseDto;
|
||||
}
|
||||
|
||||
const defaultUserInteraction: UserInteractions = {
|
||||
recentAlbums: undefined,
|
||||
versions: undefined,
|
||||
aboutInfo: undefined,
|
||||
serverInfo: undefined,
|
||||
};
|
||||
|
||||
export const resetUserInteraction = () => {
|
||||
Object.assign(userInteraction, defaultUserInteraction);
|
||||
};
|
||||
|
||||
export const userInteraction = $state<UserInteractions>(defaultUserInteraction);
|
||||
Reference in New Issue
Block a user