Handle log out
It's a little funky because of Choo, but it works right
This commit is contained in:
parent
d8f0de9ec4
commit
cd0baa7605
|
@ -9,6 +9,8 @@ export const appRoutes = (app) => {
|
|||
|
||||
app.route('/login', (state, emit) => globalView(state, emit, loginView));
|
||||
|
||||
app.route('/logout', () => window.location.reload()); // If Choo navigates here, refresh the page instead so the server can handle it and log out
|
||||
|
||||
app.route('/search', (state, emit) => globalView(state, emit, searchView));
|
||||
|
||||
app.route('/404', (state, emit) => globalView(state, emit, errorView));
|
||||
|
|
|
@ -209,11 +209,8 @@ async function routes(fastify, options) {
|
|||
});
|
||||
});
|
||||
|
||||
fastify.get('/api/logout', async (request, reply) => {
|
||||
return reply.clearCookie('token', { path: '/' }).send({
|
||||
error: false,
|
||||
message: 'api._account_logout_success',
|
||||
});
|
||||
fastify.get('/logout', async (request, reply) => {
|
||||
return reply.clearCookie('token', { path: '/' }).redirect('/');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue