mirror of
https://github.com/outline/outline.git
synced 2026-12-06 11:12:32 +03:00
fix/error-404 (#9626)
This commit is contained in:
1 parent
7176a7b8e8
commit
91c3c0e9ff
4 files changed
+51
-4
No files matched your search
@@ -26,9 +26,14 @@ import useCurrentUser from "~/hooks/useCurrentUser";
|
||||
import { usePostLoginPath } from "~/hooks/useLastVisitedPath";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { client } from "~/utils/ApiClient";
|
||||
import { AuthorizationError, OfflineError } from "~/utils/errors";
|
||||
import {
|
||||
AuthorizationError,
|
||||
NotFoundError,
|
||||
OfflineError,
|
||||
} from "~/utils/errors";
|
||||
import isCloudHosted from "~/utils/isCloudHosted";
|
||||
import { changeLanguage, detectLanguage } from "~/utils/language";
|
||||
import ErrorUnknown from "../Errors/ErrorUnknown";
|
||||
import Login from "../Login";
|
||||
import Document from "./components/Document";
|
||||
import Loading from "./components/Loading";
|
||||
@@ -178,8 +183,10 @@ function SharedDocumentScene(props: Props) {
|
||||
}
|
||||
</Login>
|
||||
);
|
||||
} else {
|
||||
} else if (error instanceof NotFoundError) {
|
||||
return <Error404 />;
|
||||
} else {
|
||||
return <ErrorUnknown />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import Error402 from "~/scenes/Errors/Error402";
|
||||
import Error403 from "~/scenes/Errors/Error403";
|
||||
import Error404 from "~/scenes/Errors/Error404";
|
||||
import ErrorOffline from "~/scenes/Errors/ErrorOffline";
|
||||
import ErrorUnknown from "~/scenes/Errors/ErrorUnknown";
|
||||
import { useDocumentContext } from "~/components/DocumentContext";
|
||||
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
||||
import useCurrentUser from "~/hooks/useCurrentUser";
|
||||
@@ -220,8 +221,10 @@ function DataLoader({ match, children }: Props) {
|
||||
<Error402 />
|
||||
) : error instanceof AuthorizationError ? (
|
||||
<Error403 />
|
||||
) : (
|
||||
) : error instanceof NotFoundError ? (
|
||||
<Error404 />
|
||||
) : (
|
||||
<ErrorUnknown />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import Flex from "@shared/components/Flex";
|
||||
import Button from "~/components/Button";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import Empty from "~/components/Empty";
|
||||
import Heading from "~/components/Heading";
|
||||
import PageTitle from "~/components/PageTitle";
|
||||
import { navigateToHome } from "~/actions/definitions/navigation";
|
||||
import useActionContext from "~/hooks/useActionContext";
|
||||
|
||||
const ErrorUnknown = () => {
|
||||
const { t } = useTranslation();
|
||||
const context = useActionContext();
|
||||
|
||||
return (
|
||||
<CenteredContent>
|
||||
<PageTitle title={t("Something went wrong")} />
|
||||
<Heading>{t("Something went wrong")}</Heading>
|
||||
<Flex gap={20} style={{ maxWidth: 500 }} column>
|
||||
<Empty size="large">
|
||||
<Trans>
|
||||
Sorry, an unknown error occurred loading the page. Please try again
|
||||
or contact support if the issue persists.
|
||||
</Trans>
|
||||
</Empty>
|
||||
<Flex gap={8}>
|
||||
<Button action={navigateToHome} context={context} neutral hideIcon>
|
||||
{t("Home")}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</CenteredContent>
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorUnknown;
|
||||
@@ -740,6 +740,8 @@
|
||||
"Your account has been suspended": "Your account has been suspended",
|
||||
"Warning Sign": "Warning Sign",
|
||||
"A workspace admin (<em>{{ suspendedContactEmail }}</em>) has suspended your account. To re-activate your account, please reach out to them directly.": "A workspace admin (<em>{{ suspendedContactEmail }}</em>) has suspended your account. To re-activate your account, please reach out to them directly.",
|
||||
"Something went wrong": "Something went wrong",
|
||||
"Sorry, an unknown error occurred loading the page. Please try again or contact support if the issue persists.": "Sorry, an unknown error occurred loading the page. Please try again or contact support if the issue persists.",
|
||||
"Created by me": "Created by me",
|
||||
"Weird, this shouldn’t ever be empty": "Weird, this shouldn’t ever be empty",
|
||||
"You haven’t created any documents yet": "You haven’t created any documents yet",
|
||||
@@ -897,7 +899,6 @@
|
||||
"Remove search": "Remove search",
|
||||
"Any author": "Any author",
|
||||
"Search titles only": "Search titles only",
|
||||
"Something went wrong": "Something went wrong",
|
||||
"Please try again or contact support if the problem persists": "Please try again or contact support if the problem persists",
|
||||
"No documents found for your search filters.": "No documents found for your search filters.",
|
||||
"Create personal API keys to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.": "Create personal API keys to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.",
|
||||
|
||||
Reference in new issue
Block a user