14 lines
374 B
TypeScript
14 lines
374 B
TypeScript
export const load = async ({ fetch, params }) => {
|
|
const res = await fetch("/api/entry/all");
|
|
const allEntries = await res.json();
|
|
|
|
const today = new Date().toISOString().split('T')[0];
|
|
const todayEntry = await fetch(`/api/entry?date=${today}`);
|
|
const todayEntryData = await todayEntry.json();
|
|
|
|
return {
|
|
all: allEntries,
|
|
today: todayEntryData,
|
|
};
|
|
};
|