
* Make channels section expandable based on override setting * Revert "Make channels section expandable based on override setting" This reverts commit e107c5e990b4110156043ed494fb0054bd936654. * Add status component * Remove no longer used component * Remove no longer used component * Removed webhook creation during App installation * Extend tRPC meta to contain webhook sync flag * Add app baseUrl to the context * Webhook management service * Add changeset
18 lines
752 B
TypeScript
18 lines
752 B
TypeScript
import * as trpcNext from "@trpc/server/adapters/next";
|
|
import { SALEOR_AUTHORIZATION_BEARER_HEADER, SALEOR_API_URL_HEADER } from "@saleor/app-sdk/const";
|
|
import { inferAsyncReturnType } from "@trpc/server";
|
|
import { getBaseUrl } from "../../lib/get-base-url";
|
|
|
|
export const createTrpcContext = async ({ res, req }: trpcNext.CreateNextContextOptions) => {
|
|
const baseUrl = getBaseUrl(req.headers);
|
|
|
|
return {
|
|
token: req.headers[SALEOR_AUTHORIZATION_BEARER_HEADER] as string | undefined,
|
|
saleorApiUrl: req.headers[SALEOR_API_URL_HEADER] as string | undefined,
|
|
appId: undefined as undefined | string,
|
|
ssr: undefined as undefined | boolean,
|
|
baseUrl,
|
|
};
|
|
};
|
|
|
|
export type TrpcContext = inferAsyncReturnType<typeof createTrpcContext>;
|