Skip to content

Commit

Permalink
fix: update user settings regardless of if persisted in the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Dec 1, 2024
1 parent 41ba801 commit 607828d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/dashboard/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default function Sidebar() {
className={`fixed left-0 top-0 z-40 flex h-screen w-72 bg-indigo-600 transition-transform dark:bg-gray-900 ${getCollapsableStateClassname()}`}
aria-label="Sidebar"
>
<div className="scrollbar-thumb-rounded-full scrollbar-track-rounded-full scrollbar scrollbar-w-2 scrollbar-thumb-gray-400 scrollbar-track-gray-100 flex min-h-full w-full flex-col overflow-y-auto">
<div className="flex min-h-full w-full flex-col overflow-y-auto scrollbar scrollbar-track-gray-100 scrollbar-thumb-gray-400 scrollbar-track-rounded-full scrollbar-thumb-rounded-full scrollbar-w-2">
<div className="flex items-center px-4 py-4">
<Tooltip content="Close sidebar">
<Button
Expand Down
1 change: 1 addition & 0 deletions src/app/dashboard/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Tooltip } from '@nextui-org/tooltip';
import NotificationsMenu from '@/app/dashboard/components/NotificationsMenu';
import { useUserSettingsStore } from '@/app/stores/userSettingsStore';
import { Link } from '@nextui-org/link';
import { isAuthenticated } from '@/app/util/auth';

export default function TopBar() {
const { data: session } = useSession();
Expand Down
12 changes: 7 additions & 5 deletions src/app/stores/userSettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ export const useUserSettingsStore = create<UserSettingsState>()(
const { success, message } = await res.json();
if (success) {
// toast.success('User settings updated successfully!');
set((state) => ({
userSettings: { ...state.userSettings, ...updatedSettings },
}));
} else {
toast.error(`Error archiving model: ${message}`);
log.error(`Error updating user settings: ${message}`);
// toast.error('Could not persist user settings');
}
} catch (e) {
log.error('Error updating user settings', e);
toast.error('Error updating user settings');
// toast.error('Could not persist user settings');
} finally {
set((state) => ({
userSettings: { ...state.userSettings, ...updatedSettings },
}));
}
} else {
set((state) => ({
Expand Down

0 comments on commit 607828d

Please sign in to comment.