diff --git a/src/helpers/defaultReminder.ts b/src/helpers/defaultReminder.ts
index 53b389b1..b24399b0 100644
--- a/src/helpers/defaultReminder.ts
+++ b/src/helpers/defaultReminder.ts
@@ -16,7 +16,7 @@ function calculateDefaultReminderSeconds(type: string, amount: number): number {
case 'months':
return amount * 60 * 60 * 24 * 30
}
-
+
return 0
}
@@ -29,14 +29,18 @@ export function saveDefaultReminder(enabled: boolean, type: string, amount: numb
}
export function getDefaultReminderAmount(): number | null {
+ const settings = getDefaultReminderSettings()
+
+ return settings?.enabled
+ ? settings.amount
+ : null
+}
+
+export function getDefaultReminderSettings(): DefaultReminderSettings | null {
const s: string | null = localStorage.getItem(DEFAULT_REMINDER_KEY)
if (s === null) {
return null
}
-
- const settings: DefaultReminderSettings = JSON.parse(s)
-
- return settings.enabled
- ? settings.amount
- : null
+
+ return JSON.parse(s)
}
diff --git a/src/views/user/settings/General.vue b/src/views/user/settings/General.vue
index ef86589b..4a16c06f 100644
--- a/src/views/user/settings/General.vue
+++ b/src/views/user/settings/General.vue
@@ -20,14 +20,14 @@
-
+
@@ -219,7 +219,7 @@ import {AuthenticatedHTTPFactory} from '@/http-common'
import {useColorScheme} from '@/composables/useColorScheme'
import {useTitle} from '@/composables/useTitle'
import {objectIsEmpty} from '@/helpers/objectIsEmpty'
-import {saveDefaultReminder} from '@/helpers/defaultReminder'
+import {getDefaultReminderSettings, saveDefaultReminder} from '@/helpers/defaultReminder'
const {t} = useI18n({useScope: 'global'})
useTitle(() => `${t('user.settings.general.title')} - ${t('user.settings.title')}`)
@@ -311,13 +311,17 @@ watch(
async function updateSettings() {
localStorage.setItem(playSoundWhenDoneKey, playSoundWhenDone.value ? 'true' : 'false')
setQuickAddMagicMode(quickAddMagicMode.value)
- saveDefaultReminder(settings.value.defaultReminder, defaultReminderAmountType.value, defaultReminderAmount.value)
+ saveDefaultReminder(defaultReminderEnabled.value, defaultReminderAmountType.value, defaultReminderAmount.value)
await authStore.saveUserSettings({
settings: {...settings.value},
})
}
+const reminderSettings = getDefaultReminderSettings()
+
+const defaultReminderEnabled = ref(reminderSettings?.enabled || false)
+// TODO: re-populate amount and type
const defaultReminderAmount = ref(1)
const defaultReminderAmountType = ref('days')