fixed duplicated ProtectedHandlerContext (#255)
This commit is contained in:
parent
007d3a167e
commit
9fefd728a2
6 changed files with 17 additions and 14 deletions
5
.changeset/fifty-carrots-crash.md
Normal file
5
.changeset/fifty-carrots-crash.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@saleor/app-sdk": patch
|
||||
---
|
||||
|
||||
Fixed invalid ProtectedHandlerContext that didnt include new user field
|
|
@ -8,7 +8,7 @@ import {
|
|||
ProtectedHandlerError,
|
||||
SaleorProtectedHandlerError,
|
||||
} from "./process-protected-handler";
|
||||
import { ProtectedHandlerContext } from "./saleor-webhooks/process-saleor-webhook";
|
||||
import { ProtectedHandlerContext } from "./protected-handler-context";
|
||||
|
||||
const debug = createDebug("ProtectedHandler");
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ export * from "./create-app-register-handler";
|
|||
export * from "./create-manifest-handler";
|
||||
export * from "./create-protected-handler";
|
||||
export * from "./process-protected-handler";
|
||||
export * from "./protected-handler-context";
|
||||
export * from "./saleor-webhooks/saleor-async-webhook";
|
||||
export * from "./saleor-webhooks/saleor-sync-webhook";
|
||||
export { NextWebhookApiHandler } from "./saleor-webhooks/saleor-webhook";
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { NextApiRequest } from "next";
|
||||
|
||||
import { APL } from "../../APL";
|
||||
import { AuthData } from "../../APL/apl";
|
||||
import { createDebug } from "../../debug";
|
||||
import { getBaseUrl, getSaleorHeaders } from "../../headers";
|
||||
import { Permission } from "../../types";
|
||||
import { extractUserFromJwt, TokenUserPayload } from "../../util/extract-user-from-jwt";
|
||||
import { extractUserFromJwt } from "../../util/extract-user-from-jwt";
|
||||
import { verifyJWT } from "../../verify-jwt";
|
||||
import { ProtectedHandlerContext } from "./protected-handler-context";
|
||||
|
||||
const debug = createDebug("processProtectedHandler");
|
||||
|
||||
|
@ -32,12 +32,6 @@ export class ProtectedHandlerError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
export type ProtectedHandlerContext = {
|
||||
baseUrl: string;
|
||||
authData: AuthData;
|
||||
user: TokenUserPayload;
|
||||
};
|
||||
|
||||
interface ProcessSaleorProtectedHandlerArgs {
|
||||
req: Pick<NextApiRequest, "headers">;
|
||||
apl: APL;
|
||||
|
|
8
src/handlers/next/protected-handler-context.ts
Normal file
8
src/handlers/next/protected-handler-context.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { AuthData } from "../../APL";
|
||||
import { TokenUserPayload } from "../../util/extract-user-from-jwt";
|
||||
|
||||
export type ProtectedHandlerContext = {
|
||||
baseUrl: string;
|
||||
authData: AuthData;
|
||||
user: TokenUserPayload;
|
||||
};
|
|
@ -45,11 +45,6 @@ export type WebhookContext<T> = {
|
|||
authData: AuthData;
|
||||
};
|
||||
|
||||
export type ProtectedHandlerContext = {
|
||||
baseUrl: string;
|
||||
authData: AuthData;
|
||||
};
|
||||
|
||||
interface ProcessSaleorWebhookArgs {
|
||||
req: NextApiRequest;
|
||||
apl: APL;
|
||||
|
|
Loading…
Reference in a new issue