Skip to content

Commit 23911a8

Browse files
committed
update: use user store prefs if available.
1 parent fe8113e commit 23911a8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/lib/stores/preferences.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { get, writable } from 'svelte/store';
66
import { sdk } from './sdk';
77
import type { Models } from '@appwrite.io/console';
88
import { organization } from './organization';
9+
import { user } from '$lib/stores/user';
910

1011
type Preferences = {
1112
limit?: number;
@@ -30,7 +31,7 @@ type PreferencesStore = {
3031
} & { hideAiDisclaimer?: boolean };
3132

3233
async function updateConsolePreferences(store: PreferencesStore): Promise<void> {
33-
const currentPreferences = await sdk.forConsole.account.getPrefs();
34+
const currentPreferences = get(user).prefs ?? (await sdk.forConsole.account.getPrefs());
3435
if (!currentPreferences?.console || Array.isArray(currentPreferences.console)) {
3536
currentPreferences.console = {};
3637
}

src/lib/stores/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { NotificationPrefItem } from '$lib/helpers/notifications';
77
export type Account = Models.User<
88
{
99
organization?: string;
10+
console: Record<string, Models.Preferences>;
1011
notificationPrefs: Record<string, NotificationPrefItem>;
1112
} & Record<string, string>
1213
>;

0 commit comments

Comments
 (0)