mirror of
https://github.com/immich-app/immich.git
synced 2026-07-28 22:51:21 -07:00
df970da59e
* chore(deps): update dependency eslint-plugin-unicorn to v70 * fix: linting --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import type {
|
|
AlbumResponseDto,
|
|
ServerAboutResponseDto,
|
|
ServerStorageResponseDto,
|
|
ServerVersionHistoryResponseDto,
|
|
} from '@immich/sdk';
|
|
import { eventManager } from '$lib/managers/event-manager.svelte';
|
|
|
|
interface UserInteractions {
|
|
recentAlbums?: AlbumResponseDto[];
|
|
versions?: ServerVersionHistoryResponseDto[];
|
|
aboutInfo?: ServerAboutResponseDto;
|
|
serverInfo?: ServerStorageResponseDto;
|
|
}
|
|
|
|
const defaultUserInteraction: UserInteractions = {
|
|
recentAlbums: undefined,
|
|
versions: undefined,
|
|
aboutInfo: undefined,
|
|
serverInfo: undefined,
|
|
};
|
|
|
|
export const userInteraction = $state<UserInteractions>(defaultUserInteraction);
|
|
|
|
const resetRecentAlbums = () => {
|
|
userInteraction.recentAlbums = undefined;
|
|
};
|
|
|
|
const reset = () => {
|
|
Object.assign(userInteraction, defaultUserInteraction);
|
|
};
|
|
|
|
// eslint-disable-next-line unicorn/no-top-level-side-effects
|
|
eventManager.on({
|
|
AlbumCreate: () => resetRecentAlbums(),
|
|
AlbumUpdate: () => resetRecentAlbums(),
|
|
AlbumDelete: () => resetRecentAlbums(),
|
|
AuthLogout: () => reset(),
|
|
});
|