diff --git a/packages/doceditor/src/components/Root.tsx b/packages/doceditor/src/components/Root.tsx index f6bddbed4d..68015d67a5 100644 --- a/packages/doceditor/src/components/Root.tsx +++ b/packages/doceditor/src/components/Root.tsx @@ -48,6 +48,7 @@ const Root = ({ isSharingAccess, editorUrl, doc, + fileId, }: TResponse) => { const documentserverUrl = editorUrl?.docServiceUrl; const fileInfo = config?.file; @@ -121,7 +122,7 @@ const Root = ({ i18n={i18n} onError={onError} > - {!fileInfo?.id ? ( + {!fileId ? ( ) : isShowDeepLink ? ( - ) : ( - <> + ) : isShowDeepLink ? null : ( +
{config && user && documentserverUrl && fileInfo && ( )} - +
)} diff --git a/packages/doceditor/src/hooks/useError.ts b/packages/doceditor/src/hooks/useError.ts index a4986217d9..fd184235f2 100644 --- a/packages/doceditor/src/hooks/useError.ts +++ b/packages/doceditor/src/hooks/useError.ts @@ -16,6 +16,7 @@ const useError = ({ error, editorUrl, t }: UseErrorProps) => { React.useEffect(() => { if (error?.message === "unauthorized") { sessionStorage.setItem("referenceUrl", window.location.href); + window.open( combineUrl(window.DocSpaceConfig?.proxy?.url, "/login"), "_self", diff --git a/packages/doceditor/src/types/index.ts b/packages/doceditor/src/types/index.ts index b3113e0ffb..f934375c82 100644 --- a/packages/doceditor/src/types/index.ts +++ b/packages/doceditor/src/types/index.ts @@ -16,8 +16,7 @@ import { TSelectedFileInfo } from "@docspace/shared/selectors/Files/FilesSelecto import SocketIOHelper from "@docspace/shared/utils/socket"; import { FilesSelectorFilterTypes } from "@docspace/shared/enums"; import { TRoomSecurity } from "@docspace/shared/api/rooms/types"; -import { Nullable, TPathParts, TTranslation } from "@docspace/shared/types"; -import { TTheme } from "@docspace/shared/themes"; +import { Nullable, TTranslation } from "@docspace/shared/types"; import { i18n } from "i18next"; export type TGoBack = { @@ -158,6 +157,7 @@ export type TResponse = isSharingAccess: boolean; error?: TError; doc?: string; + fileId?: string; } | { error: TError; @@ -168,6 +168,7 @@ export type TResponse = successAuth?: undefined; isSharingAccess?: undefined; doc?: undefined; + fileId?: string; }; export type EditorProps = { diff --git a/packages/doceditor/src/utils/actions.ts b/packages/doceditor/src/utils/actions.ts index ee57bf3aa4..42f93ed9e5 100644 --- a/packages/doceditor/src/utils/actions.ts +++ b/packages/doceditor/src/utils/actions.ts @@ -79,6 +79,7 @@ export async function getData( successAuth: false, isSharingAccess: false, doc, + fileId, }; // needed to reset rtl language in Editor @@ -110,7 +111,7 @@ export async function getData( return response; } - const response: TResponse = { error: { message: "unauthorized" } }; + const response: TResponse = { error: { message: "unauthorized" }, fileId }; return response; } catch (e) { diff --git a/packages/shared/components/error-boundary/ErrorBoundary.tsx b/packages/shared/components/error-boundary/ErrorBoundary.tsx index 01fa05afff..816d2c6f94 100644 --- a/packages/shared/components/error-boundary/ErrorBoundary.tsx +++ b/packages/shared/components/error-boundary/ErrorBoundary.tsx @@ -1,5 +1,5 @@ import React, { ErrorInfo } from "react"; -import { ThemeProvider } from "styled-components"; + import { I18nextProvider } from "react-i18next"; import Error520 from "../errors/Error520"; @@ -27,7 +27,6 @@ class ErrorBoundary extends React.Component< // You can also log the error to an error reporting service // eslint-disable-next-line no-console console.error(error, errorInfo); - const { onError } = this.props; onError?.(); @@ -53,19 +52,17 @@ class ErrorBoundary extends React.Component< if (isNextJS && theme && i18n) { return ( - - - - - + + + ); } return (