mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: event manager (#25565)
This commit is contained in:
@@ -19,7 +19,9 @@ class FoldersStore {
|
||||
private assets = $state<AssetCache>({});
|
||||
|
||||
constructor() {
|
||||
eventManager.on('AuthLogout', () => this.clearCache());
|
||||
eventManager.on({
|
||||
AuthLogout: () => this.clearCache(),
|
||||
});
|
||||
}
|
||||
|
||||
async fetchTree(): Promise<TreeNode> {
|
||||
|
||||
@@ -25,7 +25,7 @@ class MemoryStoreSvelte {
|
||||
#loading: Promise<void> | undefined;
|
||||
|
||||
constructor() {
|
||||
eventManager.onMany({
|
||||
eventManager.on({
|
||||
AuthLogout: () => this.clearCache(),
|
||||
AuthUserLoaded: () => this.initialize(),
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ class NotificationStore {
|
||||
notifications = $state<NotificationDto[]>([]);
|
||||
|
||||
constructor() {
|
||||
eventManager.onMany({
|
||||
eventManager.on({
|
||||
AuthLogin: () => this.refresh(),
|
||||
AuthLogout: () => this.clear(),
|
||||
});
|
||||
|
||||
@@ -5,7 +5,9 @@ class SearchStore {
|
||||
isSearchEnabled = $state(false);
|
||||
|
||||
constructor() {
|
||||
eventManager.on('AuthLogout', () => this.clearCache());
|
||||
eventManager.on({
|
||||
AuthLogout: () => this.clearCache(),
|
||||
});
|
||||
}
|
||||
|
||||
clearCache() {
|
||||
|
||||
@@ -16,4 +16,6 @@ export const resetSavedUser = () => {
|
||||
purchaseStore.setPurchaseStatus(false);
|
||||
};
|
||||
|
||||
eventManager.on('AuthLogout', () => resetSavedUser());
|
||||
eventManager.on({
|
||||
AuthLogout: () => resetSavedUser(),
|
||||
});
|
||||
|
||||
@@ -26,4 +26,6 @@ const reset = () => {
|
||||
Object.assign(userInteraction, defaultUserInteraction);
|
||||
};
|
||||
|
||||
eventManager.on('AuthLogout', () => reset());
|
||||
eventManager.on({
|
||||
AuthLogout: () => reset(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user