diff --git a/app/components/auth/signOut.ts b/app/components/auth/signOut.ts index 54990a8..41298a5 100644 --- a/app/components/auth/signOut.ts +++ b/app/components/auth/signOut.ts @@ -18,15 +18,15 @@ export const options: FastifySchema = { } }, }; -interface IBody { +interface IHeaders { token: string } export const signOut = async (server: FastifyInstance) => { - server.delete<{Body: IBody}>( - '/signout', + server.delete<{Headers: IHeaders}>( + '/signOut', {schema: options, preValidation: checkToken}, async (req, reply) => { - const {rowCount} = await server.pg.query('delete from root.users_access where token = $1 AND expires > current_timestamp', [req.body.token]); + const {rowCount} = await server.pg.query('delete from root.users_access where token = $1 AND expires > current_timestamp', [req.headers.token]); rowCount ? reply.send(false) : reply.status(500).send(true); } diff --git a/app/hooks/index.ts b/app/hooks/index.ts index 6635d15..da62493 100644 --- a/app/hooks/index.ts +++ b/app/hooks/index.ts @@ -2,7 +2,7 @@ import {server} from '../app'; import {FastifyReply, FastifyRequest, preHandlerAsyncHookHandler} from 'fastify'; import {RawServerBase} from 'fastify/types/utils'; import {RouteGenericInterface} from 'fastify/types/route'; -import {RequestGenericInterface} from 'fastify/types/request' +import {RequestGenericInterface} from 'fastify/types/request'; interface IBody { token?: string,