diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d8665d70..71f695a1 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -97,8 +97,7 @@ jobs: - name: Build front-end files and move to server run: | - PUBLIC_URL="$SERVER_URL" \ - VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ + VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ VITE_CLOUD_SPACE="$CLOUD_SPACE" \ VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \ VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \ diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 1e022efb..69fe9edb 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -97,8 +97,7 @@ jobs: - name: Build front-end files and move to server run: | - PUBLIC_URL="$SERVER_URL" \ - VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ + VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ VITE_CLOUD_SPACE="$CLOUD_SPACE" \ VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \ VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \ diff --git a/app/client/public/404.html b/app/client/public/404.html index d9ec8547..cb1457c5 100644 --- a/app/client/public/404.html +++ b/app/client/public/404.html @@ -19,34 +19,10 @@ /> - - - - - - - - - - - - - - - - + void) { }, [dialogShown, heading, countdownSeconds, updateDialogDescription]); } -/** Custom hook to check if user should have access to the helpdesk page */ -export function useHelpdeskAccess() { - const user = useUserData(); - const userRoles = user?.memberof.split(",") || []; - - return !user - ? "pending" - : userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk") - ? "success" - : "failure"; -} - function ProtectedRoute() { const { pathname } = useLocation(); diff --git a/app/client/src/components/userDashboard.tsx b/app/client/src/components/userDashboard.tsx index 7b8132e8..ea6fc4aa 100644 --- a/app/client/src/components/userDashboard.tsx +++ b/app/client/src/components/userDashboard.tsx @@ -5,8 +5,12 @@ import uswds from "@formio/uswds"; import icons from "uswds/img/sprite.svg"; // --- import { serverUrl, formioBaseUrl, formioProjectUrl } from "@/config"; -import { useConfigQuery, useBapSamQuery, useBapSamData } from "@/utilities"; -import { useHelpdeskAccess } from "@/components/app"; +import { + useHelpdeskAccess, + useConfigQuery, + useBapSamQuery, + useBapSamData, +} from "@/utilities"; import { Loading } from "@/components/loading"; import { useDialogActions } from "@/contexts/dialog"; diff --git a/app/client/src/routes/helpdesk.tsx b/app/client/src/routes/helpdesk.tsx index 1cc1cd20..431ae2d7 100644 --- a/app/client/src/routes/helpdesk.tsx +++ b/app/client/src/routes/helpdesk.tsx @@ -22,9 +22,9 @@ import { getData, postData, useContentData, + useHelpdeskAccess, submissionNeedsEdits, } from "@/utilities"; -import { useHelpdeskAccess } from "@/components/app"; import { Loading } from "@/components/loading"; import { Message } from "@/components/message"; import { MarkdownContent } from "@/components/markdownContent"; diff --git a/app/client/src/utilities.ts b/app/client/src/utilities.ts index 966c4aef..c90058d9 100644 --- a/app/client/src/utilities.ts +++ b/app/client/src/utilities.ts @@ -304,6 +304,18 @@ export function useUserData() { return queryClient.getQueryData(["user"]); } +/** Custom hook to check if user should have access to the helpdesk page */ +export function useHelpdeskAccess() { + const user = useUserData(); + const userRoles = user?.memberof.split(",") || []; + + return !user + ? "pending" + : userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk") + ? "success" + : "failure"; +} + /** Custom hook to fetch CSB config */ export function useConfigQuery() { return useQuery({