chore: reset the primary color after logout
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { colorPrimary } from '@/config/theme';
|
||||
import { COLOR_PRIMARY } from '@/config/theme';
|
||||
import { atom } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
@@ -14,7 +14,7 @@ const defaultSettings: UserSettings = {
|
||||
theme: 'light',
|
||||
mode: 'auto',
|
||||
isDarkTheme: false,
|
||||
colorPrimary: colorPrimary,
|
||||
colorPrimary: COLOR_PRIMARY,
|
||||
collapsed: false
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ export const userSettingsHelperAtom = atom(
|
||||
};
|
||||
set(userSettingsAtom, {
|
||||
...newSettings,
|
||||
colorPrimary: newSettings.colorPrimary || colorPrimary,
|
||||
colorPrimary: newSettings.colorPrimary || COLOR_PRIMARY,
|
||||
isDarkTheme: newSettings.theme === 'realDark'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
import { getDefaultStore } from 'jotai';
|
||||
|
||||
export const clearStorageUserSettings = () => {
|
||||
const savedSettings = JSON.parse(
|
||||
localStorage.getItem('userSettings') || '{}'
|
||||
);
|
||||
localStorage.setItem(
|
||||
'userSettings',
|
||||
JSON.stringify({
|
||||
...savedSettings,
|
||||
colorPrimary: undefined
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export const clearAtomStorage = (atom: any) => {
|
||||
if (!atom) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user