mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-10-22 13:54:10 -04:00
first pass analytics redo
This commit is contained in:
1 parent
b656fd04c0
commit
45ffa39f2a
69 files changed
+6400
-1138
No files matched your search
+3
-1
@@ -1,15 +1,17 @@
|
||||
import type { PageLoad } from './$types';
|
||||
import { getOrCreateAnonymousId } from '$lib/utils/analytics';
|
||||
|
||||
// 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 anonymousId = getOrCreateAnonymousId();
|
||||
|
||||
const res = await fetch('/api/daily-verse', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ date: localDate }),
|
||||
body: JSON.stringify({ date: localDate, anonymousId }),
|
||||
});
|
||||
|
||||
const result = await res.json();
|
||||
|
||||
Reference in new issue
Block a user