Client:Packages:Shared: fix redirect between pages wizard and unavailable

This commit is contained in:
Darya Umrikhina 2024-08-09 14:10:16 +04:00
parent 55fcbe3849
commit d7d48ec228
3 changed files with 18 additions and 3 deletions

View File

@ -36,6 +36,7 @@ import type { PublicRouteProps } from "./Routers.types";
export const PublicRoute = (props: PublicRouteProps) => {
const {
isFirstLoaded,
wizardCompleted,
isAuthenticated,
tenantStatus,
@ -89,8 +90,12 @@ export const PublicRoute = (props: PublicRouteProps) => {
/>
);
}
if (!wizardCompleted && location.pathname !== "/wizard") {
return <Navigate replace to="/wizard" />;
if (isFirstLoaded && !wizardCompleted && location.pathname !== "/wizard") {
window.location.replace(
combineUrl(window.ClientConfig?.proxy?.url, "/wizard"),
);
return null;
}
if (

View File

@ -64,5 +64,8 @@ export interface PublicRouteProps
Pick<AuthStore, "isAuthenticated">,
Pick<
SettingsStore,
"wizardCompleted" | "tenantStatus" | "isPortalDeactivate"
| "wizardCompleted"
| "tenantStatus"
| "isPortalDeactivate"
| "isFirstLoaded"
> {}

View File

@ -96,6 +96,8 @@ const isDesktopEditors = window.AscDesktopEditor !== undefined;
const systemTheme = getSystemTheme();
class SettingsStore {
isFirstLoaded = false;
isLoading = false;
interfaceDirection = "";
@ -659,6 +661,7 @@ class SettingsStore {
this.setIsLoading(false);
this.setIsLoaded(true);
this.setIsFirstLoaded(true);
};
setRoomsMode = (mode: boolean) => {
@ -673,6 +676,10 @@ class SettingsStore {
this.isLoaded = isLoaded;
};
setIsFirstLoaded = (isFirstLoaded: boolean) => {
this.isFirstLoaded = isFirstLoaded;
};
setCultures = (cultures: string[]) => {
this.cultures = cultures;
};