feat: add res to token hooks
This commit is contained in:
@@ -45,6 +45,7 @@ async function logout(incomingArgs: Arguments): Promise<string> {
|
||||
|
||||
args = (await hook({
|
||||
req,
|
||||
res,
|
||||
})) || args;
|
||||
}, Promise.resolve());
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ async function refresh(incomingArgs: Arguments): Promise<Result> {
|
||||
|
||||
args = (await hook({
|
||||
req: args.req,
|
||||
res: args.res,
|
||||
exp,
|
||||
token: refreshedToken,
|
||||
})) || args;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { DeepRequired } from 'ts-essentials';
|
||||
import { PaginateModel } from 'mongoose';
|
||||
import { GraphQLInputObjectType, GraphQLNonNull, GraphQLObjectType } from 'graphql';
|
||||
import { Response } from 'express';
|
||||
import { Access, GeneratePreviewURL, EntityDescription, Endpoint } from '../../config/types';
|
||||
import { Field } from '../../fields/config/types';
|
||||
import { PayloadRequest } from '../../express/types';
|
||||
@@ -124,6 +125,7 @@ export type AfterLoginHook<T extends TypeWithID = any> = (args: {
|
||||
|
||||
export type AfterLogoutHook<T extends TypeWithID = any> = (args: {
|
||||
req: PayloadRequest;
|
||||
res: Response;
|
||||
}) => any;
|
||||
|
||||
export type AfterMeHook<T extends TypeWithID = any> = (args: {
|
||||
@@ -133,6 +135,7 @@ export type AfterMeHook<T extends TypeWithID = any> = (args: {
|
||||
|
||||
export type AfterRefreshHook<T extends TypeWithID = any> = (args: {
|
||||
req: PayloadRequest;
|
||||
res: Response;
|
||||
token: string;
|
||||
exp: number;
|
||||
}) => any;
|
||||
|
||||
Reference in New Issue
Block a user