Use empty route to match global routes
This commit is contained in:
parent
a36fff1e9d
commit
ec7b95bbac
@ -5,7 +5,8 @@ import { LoginPage } from '../frontend/pages/login';
|
||||
const LoginHandler = new Hono();
|
||||
|
||||
LoginHandler.get('/login', async (c: Context) => {
|
||||
return c.html(<LoginPage />);
|
||||
const errors = c.get('login-errors');
|
||||
return c.html(<LoginPage error={errors} />);
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
|
@ -12,6 +12,6 @@ app.get('/', async (c) => {
|
||||
});
|
||||
|
||||
// Handlers
|
||||
app.route('/*', LoginHandler);
|
||||
app.route('', LoginHandler);
|
||||
|
||||
export default app;
|
||||
|
Loading…
Reference in New Issue
Block a user