Update public apps for dedicated host routing
Stop relying on the /trust/{id} path prefix in the public trust app and
serve it from the host root, reading contact and profile data from the
trust center instead of the organization. Mirror the same fragment
ownership change in the compliance portal hero.
Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -26,8 +26,6 @@ import { useMutation } from "react-relay";
|
||||
import { useLocation, useSearchParams } from "react-router";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import { getPathPrefix } from "#/utils/pathPrefix";
|
||||
|
||||
import type { useRequestAccessCallback_allMutation } from "./__generated__/useRequestAccessCallback_allMutation.graphql";
|
||||
import type { useRequestAccessCallback_documentMutation } from "./__generated__/useRequestAccessCallback_documentMutation.graphql";
|
||||
import type { useRequestAccessCallback_fileMutation } from "./__generated__/useRequestAccessCallback_fileMutation.graphql";
|
||||
@@ -192,7 +190,7 @@ export function useRequestAccessCallback() {
|
||||
}
|
||||
|
||||
toast(successToastArgs(__));
|
||||
window.location.href = window.location.origin + getPathPrefix() + location.pathname;
|
||||
window.location.href = window.location.origin + location.pathname;
|
||||
},
|
||||
onError: (error) => {
|
||||
toast(errorToastArgs(__, error));
|
||||
|
||||
@@ -21,14 +21,11 @@
|
||||
import { useMemo } from "react";
|
||||
import { useSearchParams } from "react-router";
|
||||
|
||||
import { getPathPrefix } from "#/utils/pathPrefix";
|
||||
|
||||
export function useSafeContinueUrl(): URL {
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const continueUrlParam = searchParams.get("continue");
|
||||
const prefix = getPathPrefix();
|
||||
const fallback = window.location.origin + (prefix || "/");
|
||||
const fallback = window.location.origin + "/";
|
||||
|
||||
const safeContinueUrl = useMemo(() => {
|
||||
if (continueUrlParam) {
|
||||
@@ -40,7 +37,7 @@ export function useSafeContinueUrl(): URL {
|
||||
}
|
||||
if (
|
||||
continueUrl.origin === window.location.origin
|
||||
&& continueUrl.pathname.startsWith(`${prefix}/`)
|
||||
&& continueUrl.pathname.startsWith("/")
|
||||
) {
|
||||
return new URL(
|
||||
continueUrl.pathname + continueUrl.search,
|
||||
@@ -50,7 +47,7 @@ export function useSafeContinueUrl(): URL {
|
||||
return new URL(fallback, window.location.origin);
|
||||
}
|
||||
return new URL(fallback, window.location.origin);
|
||||
}, [continueUrlParam, fallback, prefix]);
|
||||
}, [continueUrlParam, fallback]);
|
||||
|
||||
return safeContinueUrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user