diff --git a/frontend-v2/src/components/navigation/RegionSelect.tsx b/frontend-v2/src/components/navigation/RegionSelect.tsx index bd916fe73..7cbc22230 100644 --- a/frontend-v2/src/components/navigation/RegionSelect.tsx +++ b/frontend-v2/src/components/navigation/RegionSelect.tsx @@ -1,6 +1,6 @@ import { faCheck } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { useLocation, useNavigate } from "@tanstack/react-router"; +import { useLocation } from "@tanstack/react-router"; import { Modal, ModalContent, ModalTrigger, Select, SelectItem } from "@app/components/v2"; import { isInfisicalCloud } from "@app/helpers/platform"; @@ -73,11 +73,10 @@ const regions = [ ]; export const RegionSelect = () => { - const navigate = useNavigate(); const location = useLocation(); const handleRegionSelect = (value: Region) => { - navigate({ to: `https://${value}.infisical.com/${location.pathname}` }); + window.location.assign(`https://${value}.infisical.com/${location.pathname}`); }; const shouldDisplay = diff --git a/frontend-v2/src/hooks/api/reactQuery.tsx b/frontend-v2/src/hooks/api/reactQuery.tsx index da4113645..095ad1a7a 100644 --- a/frontend-v2/src/hooks/api/reactQuery.tsx +++ b/frontend-v2/src/hooks/api/reactQuery.tsx @@ -27,9 +27,7 @@ export const queryClient = new QueryClient({ onError: (error) => { if (axios.isAxiosError(error)) { const serverResponse = error.response?.data as TApiErrors; - console.log(serverResponse); if (serverResponse?.error === ApiErrorTypes.ValidationError) { - console.log("entered"); createNotification( { title: "Validation Error", diff --git a/frontend-v2/src/main.tsx b/frontend-v2/src/main.tsx index aa0d2acda..1fbbbf28f 100644 --- a/frontend-v2/src/main.tsx +++ b/frontend-v2/src/main.tsx @@ -5,6 +5,8 @@ import NProgress from "nprogress"; import { ContentLoader } from "./components/v2"; import { queryClient } from "./hooks/api/reactQuery"; +import { ErrorPage } from "./pages/public/ErrorPage/ErrorPage"; +import { NotFoundPage } from "./pages/public/NotFoundPage/NotFoundPage"; // Import the generated route tree import { routeTree } from "./routeTree.gen"; @@ -29,7 +31,9 @@ const router = createRouter({
- ) + ), + defaultNotFoundComponent: NotFoundPage, + defaultErrorComponent: ErrorPage }); router.subscribe("onBeforeLoad", ({ pathChanged }) => { diff --git a/frontend-v2/src/pages/middlewares/restrict-login-signup.tsx b/frontend-v2/src/pages/middlewares/restrict-login-signup.tsx index 95da2ef65..b412554eb 100644 --- a/frontend-v2/src/pages/middlewares/restrict-login-signup.tsx +++ b/frontend-v2/src/pages/middlewares/restrict-login-signup.tsx @@ -16,6 +16,11 @@ export const Route = createFileRoute("/_restrict-login-signup")({ middlewares: [stripSearchParams({ callback_port: undefined })] }, beforeLoad: async ({ context, location, search }) => { + if (!context.serverConfig.initialized) { + if (location.pathname.endsWith("/admin/signup")) return; + throw redirect({ to: "/admin/signup" }); + } + const data = await context.queryClient .fetchQuery({ queryKey: authKeys.getAuthToken, diff --git a/frontend-v2/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx b/frontend-v2/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx index aa5c0757e..264b3e5b7 100644 --- a/frontend-v2/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx +++ b/frontend-v2/src/pages/organization/AccessManagementPage/AccessManagementPage.tsx @@ -58,7 +58,6 @@ export const AccessManagementPage = () => {
{t("common.head-title", { title: t("settings.org.title") })} -

Organization Access Control

diff --git a/frontend-v2/src/pages/public/ErrorPage/ErrorPage.tsx b/frontend-v2/src/pages/public/ErrorPage/ErrorPage.tsx new file mode 100644 index 000000000..c20533915 --- /dev/null +++ b/frontend-v2/src/pages/public/ErrorPage/ErrorPage.tsx @@ -0,0 +1,62 @@ +import { faBugs, faHome } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { ErrorComponentProps, Link } from "@tanstack/react-router"; +import { AxiosError } from "axios"; + +import { Button } from "@app/components/v2"; + +export const ErrorPage = ({ error }: ErrorComponentProps) => { + return ( +
+
+ +

+ Something went wrong. Please contact{" "} + + support@infisical.com + + , or{" "} + + join our Slack community + {" "} + if the issue persists. +

+ + + + {error?.message && ( + <> +
+

+ + {window.location.pathname} +
+ {error.name} +
+ {error.message} +
+ + {error instanceof AxiosError && ( +

{JSON.stringify(error.response?.data)}
+ )} + +

+ + )} +
+
+ ); +}; diff --git a/frontend-v2/src/pages/public/NotFoundPage/NotFoundPage.tsx b/frontend-v2/src/pages/public/NotFoundPage/NotFoundPage.tsx new file mode 100644 index 000000000..fa61921cf --- /dev/null +++ b/frontend-v2/src/pages/public/NotFoundPage/NotFoundPage.tsx @@ -0,0 +1,33 @@ +import { Helmet } from "react-helmet"; +import { Link } from "@tanstack/react-router"; + +export const NotFoundPage = () => { + return ( +
+ + Infisical | Page Not Found + +
+

Oops, something went wrong

+

+ Think this is a mistake? Email{" "} + + team@infisical.com + {" "} + and we`ll fix it!{" "} +

+ +
+ Go to Dashboard +
+ + infisical dragon - page not found +
+
+ ); +}; diff --git a/frontend-v2/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx b/frontend-v2/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx index a84487c21..ff762ad5d 100644 --- a/frontend-v2/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx +++ b/frontend-v2/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx @@ -106,8 +106,6 @@ export const AccessApprovalRequest = ({ {} ); - console.log("membersGroupById", membersGroupById); - const [statusFilter, setStatusFilter] = useState<"open" | "close">("open"); const [requestedByFilter, setRequestedByFilter] = useState(undefined); const [envFilter, setEnvFilter] = useState(undefined); diff --git a/frontend-v2/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx b/frontend-v2/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx index 2716910b1..3f745b9a5 100644 --- a/frontend-v2/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx +++ b/frontend-v2/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx @@ -71,7 +71,7 @@ export const AwsElastiCacheInputForm = ({ }: Props) => { const { control, - formState: { isSubmitting, errors }, + formState: { isSubmitting }, handleSubmit } = useForm({ resolver: zodResolver(formSchema), @@ -93,7 +93,6 @@ export const AwsElastiCacheInputForm = ({ const createDynamicSecret = useCreateDynamicSecret(); - console.log("formState", errors); const handleCreateDynamicSecret = async ({ name, maxTTL, provider, defaultTTL }: TForm) => { // wait till previous request is finished if (createDynamicSecret.isPending) return; diff --git a/frontend-v2/src/pages/secret-manager/integrations/route-vercel-oauth-redirect.tsx b/frontend-v2/src/pages/secret-manager/integrations/route-vercel-oauth-redirect.tsx index 6634cdaa9..9e2b523cd 100644 --- a/frontend-v2/src/pages/secret-manager/integrations/route-vercel-oauth-redirect.tsx +++ b/frontend-v2/src/pages/secret-manager/integrations/route-vercel-oauth-redirect.tsx @@ -11,7 +11,6 @@ export const Route = createFileRoute( )({ validateSearch: zodValidator(VercelOAuthCallbackPageQueryParamsSchema), beforeLoad: ({ search }) => { - console.log("reached"); const projectId = localStorageService.getIintegrationProjectId(); if (!projectId) { createNotification({ diff --git a/frontend-v2/vite.config.ts b/frontend-v2/vite.config.ts index 93c4966b1..b73752773 100644 --- a/frontend-v2/vite.config.ts +++ b/frontend-v2/vite.config.ts @@ -22,14 +22,16 @@ const virtualRouteFileChangeReloadPlugin: PluginOption = { // https://vite.dev/config/ export default defineConfig({ server: { - proxy: { - "/api": { - target: "http://localhost:8080", - changeOrigin: true, - secure: false, - ws: true - } - } + host: true, + port: 3000 + // proxy: { + // "/api": { + // target: "http://localhost:8080", + // changeOrigin: true, + // secure: false, + // ws: true + // } + // } }, plugins: [ tsconfigPaths(),