Client: added a transition to the domain after management portal configuration

This commit is contained in:
Dmitry Sychugov 2023-11-28 18:14:34 +05:00
parent fb470dc1ca
commit dab0608858
2 changed files with 16 additions and 1 deletions

View File

@ -2,12 +2,15 @@ import React, { useEffect } from "react";
import Loader from "@docspace/components/loader";
import Section from "@docspace/common/components/Section";
import { loginWithConfirmKey } from "@docspace/common/api/user";
import { useSearchParams } from "react-router-dom";
import { combineUrl } from "@docspace/common/utils";
import toastr from "@docspace/components/toast/toastr";
import { frameCallEvent } from "@docspace/common/utils";
const Auth = (props) => {
//console.log("Auth render");
const { linkData } = props;
let [searchParams, setSearchParams] = useSearchParams();
useEffect(() => {
loginWithConfirmKey({
ConfirmData: {
@ -18,6 +21,14 @@ const Auth = (props) => {
.then((res) => {
//console.log("Login with confirm key success", res);
frameCallEvent({ event: "onAuthSuccess" });
const url = searchParams.get("referenceUrl");
if (url) {
return window.location.replace(
combineUrl(window.location.origin, url)
);
}
if (typeof res === "string") window.location.replace(res);
else window.location.replace("/");
})

View File

@ -54,7 +54,11 @@ const ConfigurationSection = ({ t }: TConfigurationSection): JSX.Element => {
try {
await setDomainName(domain);
await setPortalName(name);
await setPortalName(name).then((result) => {
let url = new URL(result);
url.searchParams.append("referenceUrl", "/management");
return window.location.replace(url);
})
await authStore.settingsStore.getAllPortals();
} catch (err) {