feat: save user settings to db

This commit is contained in:
Timothy J. Baek
2024-05-26 22:47:42 -07:00
parent 9d4c07b76a
commit ccbafca74c
16 changed files with 235 additions and 70 deletions

View File

@@ -33,6 +33,7 @@
import ArchiveBox from '../icons/ArchiveBox.svelte';
import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
import UserMenu from './Sidebar/UserMenu.svelte';
import { updateUserSettings } from '$lib/apis/users';
const BREAKPOINT = 768;
@@ -184,6 +185,8 @@
const saveSettings = async (updated) => {
await settings.set({ ...$settings, ...updated });
localStorage.setItem('settings', JSON.stringify($settings));
await updateUserSettings(localStorage.token, { ui: $settings });
location.href = '/';
};