feat: add res to token hooks

This commit is contained in:
Dan Ribbens
2022-07-09 19:38:24 -04:00
parent 4055908bc8
commit 166bd31506
3 changed files with 5 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ async function logout(incomingArgs: Arguments): Promise<string> {
args = (await hook({
req,
res,
})) || args;
}, Promise.resolve());

View File

@@ -87,6 +87,7 @@ async function refresh(incomingArgs: Arguments): Promise<Result> {
args = (await hook({
req: args.req,
res: args.res,
exp,
token: refreshedToken,
})) || args;

View File

@@ -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;