build out home page, need to link things up tho

This commit is contained in:
Ean Milligan
2026-04-10 15:11:32 -04:00
parent 6a02684a2a
commit 1cabb376d9
3 changed files with 48 additions and 4 deletions

4
mod.ts
View File

@@ -43,13 +43,13 @@ Deno.serve({ port: config.api.port }, async (req) => {
} else if (path.startsWith('/home/')) {
// SSR "home page"
const userId = path.replace('/home/', '');
const userMatch = await dbClient.query('SELECT id FROM users WHERE id = ?', [userId]).catch(() => {
const userMatch = await dbClient.query('SELECT name FROM users WHERE id = ?', [userId]).catch(() => {
failed = true;
});
if (failed) return buildPage("Couldn't read DB. Please try again.");
if (!userMatch.length) return buildPage('User ID does not exist. Please click on the page header to go back to the sign in page.');
return buildPage(buildHome(userId));
return buildPage(await buildHome(userId, userMatch[0].name));
} else if (path.startsWith('/read/')) {
const planId = path.replace('/read/', '');