File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ export const options: FastifySchema = {
18
18
}
19
19
} ,
20
20
} ;
21
- interface IBody {
21
+ interface IHeaders {
22
22
token : string
23
23
}
24
24
export const signOut = async ( server : FastifyInstance ) => {
25
- server . delete < { Body : IBody } > (
26
- '/signout ' ,
25
+ server . delete < { Headers : IHeaders } > (
26
+ '/signOut ' ,
27
27
{ schema : options , preValidation : checkToken } ,
28
28
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 ] ) ;
30
30
31
31
rowCount ? reply . send ( false ) : reply . status ( 500 ) . send ( true ) ;
32
32
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import {server} from '../app';
2
2
import { FastifyReply , FastifyRequest , preHandlerAsyncHookHandler } from 'fastify' ;
3
3
import { RawServerBase } from 'fastify/types/utils' ;
4
4
import { RouteGenericInterface } from 'fastify/types/route' ;
5
- import { RequestGenericInterface } from 'fastify/types/request'
5
+ import { RequestGenericInterface } from 'fastify/types/request' ;
6
6
7
7
interface IBody {
8
8
token ?: string ,
You can’t perform that action at this time.
0 commit comments