Merge branch 'release/rc-v1.2.0' into feature/static-versioned

This commit is contained in:
Alexey Safronov 2022-12-23 11:26:50 +03:00
commit cd581cb15d
3 changed files with 14 additions and 7 deletions

View File

@ -124,7 +124,10 @@ class AxiosClient {
// : error.message;
if (error?.response?.status === 401 && this.isSSR) {
error.response.data.error.message = 401;
error.response.data = {
...error?.response?.data,
error: { ...error?.response?.data?.error, message: 401 },
};
}
const loginURL = combineUrl(proxyURL, "/login");

View File

@ -96,9 +96,12 @@ function Editor({
}
useEffect(() => {
if (error && mfReady) {
if (error?.unAuthorized && error?.redirectPath) {
if (error?.unAuthorized) {
localStorage.setItem("redirectPath", window.location.href);
window.location.href = error?.redirectPath;
window.open(
combineUrl(window.DocSpaceConfig?.proxy?.url, "/login"),
"_self"
);
}
const errorText = typeof error === "string" ? error : error.errorMessage;
toastr.error(errorText);

View File

@ -80,15 +80,16 @@ export const initDocEditor = async (req) => {
]);
const successAuth = !!user;
personal = settings?.personal;
if (!successAuth && !doc) {
error = {
unAuthorized: true,
redirectPath: combineUrl(
window.DocSpaceConfig?.proxy?.url,
personal ? "/sign-in" : "/login"
),
// redirectPath: combineUrl(
// window?.DocSpaceConfig?.proxy?.url,
// personal ? "/sign-in" : "/login"
// ),
};
return { error };
}