fix: admin app redirections

This commit is contained in:
sriram veeraghanta 2024-05-10 15:23:51 +05:30
parent 243680132e
commit 40560109b5
39 changed files with 99 additions and 91 deletions

View file

@ -4,11 +4,11 @@ import { FC, ReactNode, useEffect, Suspense } from "react";
import { observer } from "mobx-react-lite";
import { SWRConfig } from "swr";
// hooks
import { useTheme, useUser } from "@/hooks";
import { useTheme, useUser } from "@/hooks/store";
// ui
import { Toast } from "@plane/ui";
// constants
import { SWR_CONFIG } from "constants/swr-config";
import { SWR_CONFIG } from "@/constants/swr-config";
// helpers
import { resolveGeneralTheme } from "helpers/common.helper";

View file

@ -6,7 +6,7 @@ import { observer } from "mobx-react-lite";
import useSWR from "swr";
import { Spinner } from "@plane/ui";
// hooks
import { useInstance, useUser } from "@/hooks";
import { useInstance, useUser } from "@/hooks/store";
// helpers
import { EAuthenticationPageType } from "@/helpers";

View file

@ -10,7 +10,7 @@ import { DefaultLayout } from "@/layouts";
// components
import { InstanceNotReady } from "@/components/instance";
// hooks
import { useInstance } from "@/hooks";
import { useInstance } from "@/hooks/store";
// helpers
import { EInstancePageType } from "@/helpers";
@ -28,6 +28,9 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
const { isLoading: isSWRLoading } = useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), {
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: false,
errorRetryCount: 0,
});
if (isSWRLoading || isLoading)
@ -37,6 +40,10 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
</div>
);
if (!instance) {
return <>Something went wrong</>;
}
if (instance?.instance?.is_setup_done === false && authEnabled === "1")
return (
<DefaultLayout withoutBackground>