File tree Expand file tree Collapse file tree
auth-providers/dbAuth/api/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,21 +47,17 @@ export const parseFetchEventBody = async (event: Request) => {
4747 return body ? JSON . parse ( body ) : undefined
4848}
4949
50- // @TODO
51- // @TODO
52- // @TODO
53- // THis is in a hacked state. Need to figure out why instanceof isn't working in middleware
54- export const isFetchApiRequest = ( event : any ) : event is Request => {
55- if ( event instanceof Request || event instanceof PonyFillRequest ) {
50+ export const isFetchApiRequest = (
51+ event : Request | APIGatewayProxyEvent
52+ ) : event is Request => {
53+ if (
54+ event . constructor . name === 'Request' ||
55+ event . constructor . name === PonyFillRequest . name
56+ ) {
5657 return true
5758 }
5859
59- if ( event . httpMethod || event . queryStringParameters ) {
60- return false
61- }
62-
63- // @TODO I dont know why instance of Request is not working in middleware
64- return true
60+ return false
6561}
6662
6763function getQueryStringParams ( reqUrl : string ) {
Original file line number Diff line number Diff line change @@ -393,10 +393,6 @@ export class DbAuthHandler<
393393 this . options = options
394394 this . event = event
395395 this . httpMethod = isFetchApiRequest ( event ) ? event . method : event . httpMethod
396- console . log (
397- `👉 \n ~ file: DbAuthHandler.ts:396 ~ isFetchApiRequest(event):` ,
398- isFetchApiRequest ( event )
399- )
400396
401397 this . cookie = extractCookie ( event ) || ''
402398
You can’t perform that action at this time.
0 commit comments