feat: add Daily Digest and Push Notifications toggles to User Profile with corresponding functionality
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m37s

This commit is contained in:
2026-04-18 23:37:19 -04:00
parent 9efbb455d7
commit d7b1962903
2 changed files with 14 additions and 4 deletions

View File

@@ -317,17 +317,18 @@ async function resetPassword() {
}
}
async function toggleDigest(newValue: boolean) {
async function toggleDigest(newValue?: boolean) {
const value = newValue ?? !emailDigestEnabled.value
digestError.value = ''
savingDigest.value = true
try {
const res = await fetch('/api/user/profile', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email_digest_enabled: newValue }),
body: JSON.stringify({ email_digest_enabled: value }),
})
if (!res.ok) throw new Error('Failed to update preference')
emailDigestEnabled.value = newValue
emailDigestEnabled.value = value
} catch {
digestError.value = 'Failed to save notification preference.'
} finally {