Skip to content

Commit

Permalink
Move to use new Request for JWTs (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
cancan101 authored Jun 9, 2022
1 parent 16694dd commit 41c9476
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
param,
} from "express-validator";
import jsonwebtoken from "jsonwebtoken";
import { expressjwt, ExpressJwtRequestUnrequired } from "express-jwt";
import { expressjwt, Request as JWTRequest } from "express-jwt";
import sgMail from "@sendgrid/mail";
import { cleanEnv, str, email, port, num } from "envalid";
import fs from "fs";
Expand Down Expand Up @@ -261,7 +261,7 @@ app.get(
corsMiddleware,
...UseJwt,
param("threadId").isString(),
async (req: ExpressJwtRequestUnrequired, res: Response): Promise<void> => {
async (req: JWTRequest, res: Response): Promise<void> => {
if (!req.auth || !req.auth.sub) {
res.status(401).send(JSON.stringify({}));
return;
Expand Down Expand Up @@ -295,7 +295,7 @@ app.get(
corsMiddleware,
...UseJwt,
query("userId").isUUID(),
async (req: ExpressJwtRequestUnrequired, res: Response): Promise<void> => {
async (req: JWTRequest, res: Response): Promise<void> => {
if (!req.auth || !req.auth.sub) {
res.status(401).send(JSON.stringify({}));
return;
Expand Down Expand Up @@ -337,7 +337,7 @@ app.post(
body("emailId").isString(),
body("emailSubject").isString(),
body("scheduledTimestamp").isInt({ gt: 0 }).optional(),
async (req: ExpressJwtRequestUnrequired, res: Response): Promise<void> => {
async (req: JWTRequest, res: Response): Promise<void> => {
if (!req.auth || !req.auth.sub) {
res.status(401).send(JSON.stringify({}));
return;
Expand Down

0 comments on commit 41c9476

Please sign in to comment.