File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ function getTokenInfo(accessToken: string) {
130130}
131131
132132export default async ( req : NextApiRequest , res : NextApiResponse ) => {
133- const { NODE_ENV , DOMAIN , HOSTED } = process . env
133+ const { NODE_ENV , DOMAIN , HOSTED , NEXT_PUBLIC_SLUG } = process . env
134134 const accessToken = req . query . accessToken as string
135135 const orderId = req . query . orderId as string
136136
@@ -151,7 +151,9 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
151151 return invalidateCheckout ( )
152152 }
153153
154- const subdomain = req . headers . host ?. split ( ":" ) [ 0 ] . split ( "." ) [ 0 ]
154+ const subdomain = HOSTED
155+ ? req . headers . host ?. split ( ":" ) [ 0 ] . split ( "." ) [ 0 ]
156+ : NEXT_PUBLIC_SLUG
155157
156158 const { slug, kind, isTest } = getTokenInfo ( accessToken )
157159
@@ -161,7 +163,6 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
161163
162164 if (
163165 isProduction ( NODE_ENV ) &&
164- ! ! HOSTED &&
165166 ( subdomain !== slug || kind !== "sales_channel" )
166167 ) {
167168 return invalidateCheckout ( )
You can’t perform that action at this time.
0 commit comments