diff --git a/editor.planx.uk/src/routes/index.tsx b/editor.planx.uk/src/routes/index.tsx index cbcb28b0f5..8a7d8048fd 100644 --- a/editor.planx.uk/src/routes/index.tsx +++ b/editor.planx.uk/src/routes/index.tsx @@ -1,4 +1,3 @@ -import { logger } from "airbrake"; import { lazy, map, mount, redirect, route } from "navi"; import * as React from "react"; @@ -57,28 +56,25 @@ const editorRoutes = mount({ ), }); -const mountPayRoutes = () => - map(async () => { - try { - return lazy(() => import("./pay")); - } catch (error) { - console.log("ERROR MOUNTING PAY ROUTES"); - logger.notify(error); - throw Error(`error in pay mount: ${error}`); - } - }); +const tryImport = () => { + try { + return lazy(() => import("./pay")); + } catch (error) { + throw Error(`ERROR MOUNTING PAY ROUTES (LAZY): ${error}`); + } +}; export default isPreviewOnlyDomain ? mount({ "/:team/:flow/preview": lazy(() => import("./preview")), // XXX: keeps old URL working, but only for the team listed in the domain. "/:flow": lazy(() => import("./preview")), - "/:flow/pay": mountPayRoutes(), + "/:flow/pay": tryImport(), // XXX: We're not sure where to redirect `/` to so for now we'll just return the default 404 // "/": redirect("somewhere?"), }) : mount({ "/:team/:flow/preview": lazy(() => import("./preview")), // loads published flow if exists, or current flow "/:team/:flow/unpublished": lazy(() => import("./unpublished")), // loads current flow - "/:team/:flow/pay": mountPayRoutes(), + "/:team/:flow/pay": tryImport(), "*": editorRoutes, }); diff --git a/editor.planx.uk/src/routes/pay.tsx b/editor.planx.uk/src/routes/pay.tsx index d7e9fe3368..1b1cc5cdf9 100644 --- a/editor.planx.uk/src/routes/pay.tsx +++ b/editor.planx.uk/src/routes/pay.tsx @@ -21,6 +21,7 @@ import standaloneView from "./views/standalone"; const payRoutes = compose( withData(async (req) => { + console.log("inside pay withData"); try { const externalDomainTeam = await getTeamFromDomain( window.location.hostname, @@ -46,6 +47,7 @@ const payRoutes = compose( mount({ "/": route(async (req) => { + console.log("inside pay mount"); const paymentRequest = await getPaymentRequest(req); if (!paymentRequest) { return { diff --git a/editor.planx.uk/src/routes/utils.ts b/editor.planx.uk/src/routes/utils.ts index 9822188c8a..4e7541f12b 100644 --- a/editor.planx.uk/src/routes/utils.ts +++ b/editor.planx.uk/src/routes/utils.ts @@ -90,6 +90,7 @@ export const getTeamFromDomain = pMemoize(async (domain: string) => { * e.g. https://planningservices.southwark.gov.uk/lambeth/some-flow/preview */ export const validateTeamRoute = async (req: NaviRequest) => { + console.log("inside ValidateTeamRoute"); const externalTeamName = await getTeamFromDomain(window.location.hostname); if ( req.params.team &&