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
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m37s
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user