mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-15 13:21:11 +00:00
Merge pull request #4954 from Dokploy/fix/error-page-status-code
fix(ui): show real status code on error page
This commit is contained in:
@@ -5,12 +5,11 @@ import { buttonVariants } from "@/components/ui/button";
|
|||||||
import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
|
import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
statusCode: number;
|
statusCode?: number;
|
||||||
error?: Error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Custom404({ statusCode, error }: Props) {
|
export default function ErrorPage({ statusCode }: Props) {
|
||||||
const displayStatusCode = statusCode || 400;
|
const displayStatusCode = statusCode || 500;
|
||||||
const { config: whitelabeling } = useWhitelabelingPublic();
|
const { config: whitelabeling } = useWhitelabelingPublic();
|
||||||
const appName = whitelabeling?.appName || "Dokploy";
|
const appName = whitelabeling?.appName || "Dokploy";
|
||||||
const logoUrl = whitelabeling?.logoUrl || undefined;
|
const logoUrl = whitelabeling?.logoUrl || undefined;
|
||||||
@@ -45,12 +44,6 @@ export default function Custom404({ statusCode, error }: Props) {
|
|||||||
{errorDescription}
|
{errorDescription}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{error && (
|
|
||||||
<div className="mt-3 text-red-500">
|
|
||||||
<p>{error.message}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="mt-5 flex flex-col justify-center items-center gap-2 sm:flex-row sm:gap-3">
|
<div className="mt-5 flex flex-col justify-center items-center gap-2 sm:flex-row sm:gap-3">
|
||||||
<Link
|
<Link
|
||||||
href="/dashboard/home"
|
href="/dashboard/home"
|
||||||
@@ -101,8 +94,7 @@ export default function Custom404({ statusCode, error }: Props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
ErrorPage.getInitialProps = ({ res, err }: NextPageContext) => {
|
||||||
Error.getInitialProps = ({ res, err }: NextPageContext) => {
|
const statusCode = res ? res.statusCode : err ? (err.statusCode ?? 500) : 404;
|
||||||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
|
return { statusCode };
|
||||||
return { statusCode, error: err };
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user