11import h from "./main.module.styl" ;
22import { CenteredContentPage } from "~/layouts" ;
3- import { PageHeader } from "~/components" ;
3+ import { Link , PageHeader } from "~/components" ;
44import { usePageContext } from "vike-react/usePageContext" ;
55import { ClientOnly } from "vike-react/ClientOnly" ;
66import { Spinner , Button , Card } from "@blueprintjs/core" ;
@@ -10,17 +10,6 @@ import { LinkCard } from "~/components";
1010export function Page ( ) {
1111 const ctx = usePageContext ( ) ;
1212 const is404 = ctx . is404 ;
13-
14- return h ( CenteredContentPage , [ h ( PageHeader ) , h ( PageContent ) ] ) ;
15- }
16-
17- function PageContent ( ) {
18- const ctx = usePageContext ( ) ;
19- const is404 = ctx . is404 ;
20- const path = ctx . urlPathname ;
21- const statusCode = ctx . abortStatusCode ;
22- const reason = ctx . abortReason ;
23-
2413 if ( is404 ) {
2514 return h ( "div.error404" , [
2615 h ( BlankImage , {
@@ -34,15 +23,27 @@ function PageContent() {
3423 h ( "h2" , "The rock you are looking for doesn't exist. Keep digging." ) ,
3524 h ( "div.buttons" , [
3625 h (
37- "button" ,
26+ LinkCard ,
3827 { className : "btn" , onClick : ( ) => history . back ( ) } ,
3928 "Go back"
4029 ) ,
41- h ( "a" , { className : "btn" , href : "/" } , "Go home" ) ,
30+ h ( LinkCard , { className : "btn" , href : "/" } , "Go home" ) ,
4231 ] ) ,
4332 ] ) ,
4433 ] ) ;
45- } else if ( statusCode == 401 ) {
34+ }
35+
36+ return h ( CenteredContentPage , [ h ( PageHeader ) , h ( PageContent ) ] ) ;
37+ }
38+
39+ function PageContent ( ) {
40+ const ctx = usePageContext ( ) ;
41+ const is404 = ctx . is404 ;
42+ const path = ctx . urlPathname ;
43+ const statusCode = ctx . abortStatusCode ;
44+ const reason = ctx . abortReason ;
45+
46+ if ( statusCode == 401 ) {
4647 return h ( [
4748 h ( "h1" , [ h ( "code.bp5-code" , "401" ) , " Unauthorized" ] ) ,
4849 h ( "p" , [ reason ] ) ,
0 commit comments