mirror of
				https://gitlab.com/Alamantus/Readlebee.git
				synced 2025-11-04 10:17:03 +01: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('/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…
	
	Add table
		
		Reference in a new issue