From ec7b95bbac4c57c82e44ae2b52715534612c6230 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sun, 3 Mar 2024 22:25:48 -0500 Subject: [PATCH] Use empty route to match global routes --- app/src/handlers/login.tsx | 5 +++-- app/src/index.tsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/handlers/login.tsx b/app/src/handlers/login.tsx index 291179a..0698a44 100644 --- a/app/src/handlers/login.tsx +++ b/app/src/handlers/login.tsx @@ -5,7 +5,8 @@ import { LoginPage } from '../frontend/pages/login'; const LoginHandler = new Hono(); LoginHandler.get('/login', async (c: Context) => { - return c.html(); + const errors = c.get('login-errors'); + return c.html(); }); LoginHandler.post('/login', async (c: Context) => { @@ -21,7 +22,7 @@ LoginHandler.post('/login', async (c: Context) => { } } - c.set('login-errors', {}); + c.set('login-errors', { error: { message: "Bad credentials" }}); return c.redirect('/login'); }); diff --git a/app/src/index.tsx b/app/src/index.tsx index ea8f232..92f16be 100644 --- a/app/src/index.tsx +++ b/app/src/index.tsx @@ -12,6 +12,6 @@ app.get('/', async (c) => { }); // Handlers -app.route('/*', LoginHandler); +app.route('', LoginHandler); export default app;