}
}
} catch (error) {
- errorPageData = getErrorRouteData(error, site);
+ errorPageData = getErrorPageData(error, site);
}
// Redirect to the 404 if there's an API error
if (error === "instance_is_private") {
return res.redirect(`/signup`);
} else {
- errorPageData = getErrorRouteData(error, site);
+ errorPageData = getErrorPageData(error, site);
}
}
.then(blob => blob.arrayBuffer());
}
-function getErrorRouteData(error: string, site?: GetSiteResponse) {
+function getErrorPageData(error: string, site?: GetSiteResponse) {
const errorPageData: ErrorPageData = {};
// Exact error should only be seen in a development environment. Users
render() {
const errorPageData = this.isoData.errorPageData;
const siteRes = this.isoData.site_res;
+ console.log("In error guard");
+ console.log(errorPageData);
if (errorPageData || !siteRes) {
+ console.log("triggered error page");
return <ErrorPage />;
} else {
return this.props.children;
export function setIsoData(context: any): IsoData {
// If its the browser, you need to deserialize the data from the window
if (isBrowser()) {
- let json = window.isoData;
- let routeData = json.routeData;
- let site_res = json.site_res;
-
- let isoData: IsoData = {
- path: json.path,
- site_res,
- routeData,
- };
- return isoData;
+ return window.isoData;
} else return context.router.staticContext;
}