Skip to content

Commit 72235ce

Browse files
committed
fix bug in signOut.ts
1 parent 3c6d68b commit 72235ce

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/components/auth/signOut.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ export const options: FastifySchema = {
1818
}
1919
},
2020
};
21-
interface IBody {
21+
interface IHeaders {
2222
token: string
2323
}
2424
export const signOut = async (server: FastifyInstance) => {
25-
server.delete<{Body: IBody}>(
26-
'/signout',
25+
server.delete<{Headers: IHeaders}>(
26+
'/signOut',
2727
{schema: options, preValidation: checkToken},
2828
async (req, reply) => {
29-
const {rowCount} = await server.pg.query('delete from root.users_access where token = $1 AND expires > current_timestamp', [req.body.token]);
29+
const {rowCount} = await server.pg.query('delete from root.users_access where token = $1 AND expires > current_timestamp', [req.headers.token]);
3030

3131
rowCount ? reply.send(false) : reply.status(500).send(true);
3232
}

app/hooks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {server} from '../app';
22
import {FastifyReply, FastifyRequest, preHandlerAsyncHookHandler} from 'fastify';
33
import {RawServerBase} from 'fastify/types/utils';
44
import {RouteGenericInterface} from 'fastify/types/route';
5-
import {RequestGenericInterface} from 'fastify/types/request'
5+
import {RequestGenericInterface} from 'fastify/types/request';
66

77
interface IBody {
88
token?: string,

0 commit comments

Comments
 (0)