MCPcopy Create free account
hub / github.com/app-generator/api-server-nodejs / logoutUser

Function logoutUser

src/controllers/logout.controller.ts:4–13  ·  view source on GitHub ↗
(req: any, res: any)

Source from the content-addressed store, hash-verified

2import { connection } from '../server/database';
3
4export const logoutUser = (req: any, res: any) => {
5 const { token } = req.body;
6 const activeSessionRepository = connection!.getRepository(ActiveSession);
7
8 activeSessionRepository.delete({ token })
9 .then(() => res.json({ success: true }))
10 .catch(() => {
11 res.json({ success: false, msg: 'Token revoked' });
12 });
13 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected