-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
export default function Page(props: { is404: boolean; errorInfo?: string }) { | ||
if (props.is404) { | ||
return ( | ||
<> | ||
<h1>404 Page Not Found</h1> | ||
<p>This page could not be found.</p> | ||
<p>{props.errorInfo}</p> | ||
</> | ||
); | ||
} else { | ||
return ( | ||
<> | ||
<h1>500 Internal Server Error</h1> | ||
<p>Something went wrong.</p> | ||
</> | ||
); | ||
} | ||
import { Show } from "solid-js"; | ||
import { usePageContext } from "vike-solid/usePageContext"; | ||
|
||
export default function Page() { | ||
const { is404 } = usePageContext() | ||
|
||
return ( | ||
<Show | ||
when={is404} | ||
fallback={ | ||
<> | ||
<h1>500 Internal Server Error</h1> | ||
<p>Something went wrong.</p> | ||
</> | ||
} | ||
> | ||
<h1>404 Page Not Found</h1> | ||
<p>This page could not be found.</p> | ||
</Show> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
export default function Page(props: { is404: boolean; errorInfo?: string }) { | ||
if (props.is404) { | ||
return ( | ||
<> | ||
<h1>404 Page Not Found</h1> | ||
<p>This page could not be found.</p> | ||
<p>{props.errorInfo}</p> | ||
</> | ||
); | ||
} else { | ||
return ( | ||
<> | ||
<h1>500 Internal Server Error</h1> | ||
<p>Something went wrong.</p> | ||
</> | ||
); | ||
} | ||
import { Show } from "solid-js"; | ||
import { usePageContext } from "vike-solid/usePageContext"; | ||
|
||
export default function Page() { | ||
const { is404 } = usePageContext() | ||
|
||
return ( | ||
<Show | ||
when={is404} | ||
fallback={ | ||
<> | ||
<h1>500 Internal Server Error</h1> | ||
<p>Something went wrong.</p> | ||
</> | ||
} | ||
> | ||
<h1>404 Page Not Found</h1> | ||
<p>This page could not be found.</p> | ||
</Show> | ||
); | ||
} |