Skip to content

Commit

Permalink
Improve Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretSaturn committed May 5, 2024
1 parent 06662fe commit 957dd73
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ function Settings() {
validateOnChange: true,
onSubmit: async (values) => {
try {
setTheme(values.theme as Theme)
setCurrency(values.currency as Currency)
setDebugMode(values.debugMode)
setIsModalOpen(false)
window.location.reload()
if (values.theme !== theme || values.debugMode !== debugMode) {
setTheme(values.theme as Theme)
setDebugMode(values.debugMode)
setIsModalOpen(false)
}

if (values.currency !== currency) {
setCurrency(values.currency as Currency)
window.location.reload()
}
} catch (error: any) {
console.error('error after submitting settings:', error)
NotificationService.notify(`An error occured while saving user settings!`, 'error')
Expand Down

0 comments on commit 957dd73

Please sign in to comment.