mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-04-05 17:33:31 -04:00
Extracted game state management, share logic, and stats API calls into dedicated modules (game-persistence.svelte.ts, share.ts, stats-client.ts), and moved daily verse loading to client-side to fix timezone issues. Added a guesses column to daily_completions for cross-device state restoration for logged-in users, a new GET /api/stats endpoint, and a staging deploy script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
609 B
TypeScript
24 lines
609 B
TypeScript
import type { PageLoad } from './$types';
|
|
|
|
// Disable SSR so the load function runs on the client with the correct local date
|
|
export const ssr = false;
|
|
|
|
export const load: PageLoad = async ({ fetch, data }) => {
|
|
const localDate = new Date().toLocaleDateString("en-CA");
|
|
|
|
const res = await fetch('/api/daily-verse', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ date: localDate }),
|
|
});
|
|
|
|
const result = await res.json();
|
|
|
|
return {
|
|
...data,
|
|
dailyVerse: result.dailyVerse,
|
|
correctBookId: result.correctBookId,
|
|
correctBook: result.correctBook,
|
|
};
|
|
};
|