feat: add server persistence for rosary streak
All checks were successful
CI / update (push) Successful in 1m21s
All checks were successful
CI / update (push) Successful in 1m21s
- Add RosaryStreak MongoDB model for logged-in users - Add /api/glaube/rosary-streak GET/POST endpoints - Sync streak to server when logged in, merge local/server data - Auto-sync when coming back online (PWA offline support) - Falls back to localStorage for guests
This commit is contained in:
@@ -2,7 +2,20 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { getRosaryStreak } from '$lib/stores/rosaryStreak.svelte';
|
||||
|
||||
interface Props {
|
||||
user?: { nickname?: string } | null;
|
||||
}
|
||||
|
||||
let { user = null }: Props = $props();
|
||||
|
||||
const streak = browser ? getRosaryStreak() : null;
|
||||
|
||||
// Sync with server when user is logged in
|
||||
$effect(() => {
|
||||
if (browser && streak) {
|
||||
streak.setLoggedIn(!!user?.nickname);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="streak-container">
|
||||
|
||||
Reference in New Issue
Block a user