build out home page, need to link things up tho
This commit is contained in:
4
mod.ts
4
mod.ts
@@ -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/', '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user