mirror of
https://gitlab.com/Alamantus/Readlebee.git
synced 2025-05-08 03:01:15 +02:00
Handle log out
It's a little funky because of Choo, but it works right
This commit is contained in:
parent
d8f0de9ec4
commit
cd0baa7605
2 changed files with 4 additions and 5 deletions
|
@ -9,6 +9,8 @@ export const appRoutes = (app) => {
|
||||||
|
|
||||||
app.route('/login', (state, emit) => globalView(state, emit, loginView));
|
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('/search', (state, emit) => globalView(state, emit, searchView));
|
||||||
|
|
||||||
app.route('/404', (state, emit) => globalView(state, emit, errorView));
|
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) => {
|
fastify.get('/logout', async (request, reply) => {
|
||||||
return reply.clearCookie('token', { path: '/' }).send({
|
return reply.clearCookie('token', { path: '/' }).redirect('/');
|
||||||
error: false,
|
|
||||||
message: 'api._account_logout_success',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue