-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: upgrade vite-plugin-ssr and migrate to Vike
`vite-plugin-ssr` is now renamed to Vike. https://vite-plugin-ssr.com/vike
- Loading branch information
1 parent
cea9003
commit e20dba5
Showing
24 changed files
with
1,200 additions
and
519 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
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
2 changes: 1 addition & 1 deletion
2
apps/webapp/src/features/auth/components/LoginForm/LoginForm.tsx
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
2 changes: 1 addition & 1 deletion
2
apps/webapp/src/features/auth/components/RegisterForm/RegisterForm.tsx
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { redirect } from 'vike/abort' | ||
import { type PageContext } from 'vike/types' | ||
|
||
export const guard = (pageContext: PageContext) => { | ||
if (pageContext.currentUser) { | ||
throw redirect('/') | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { redirect } from 'vike/abort' | ||
import { type PageContext } from 'vike/types' | ||
|
||
export const guard = (pageContext: PageContext) => { | ||
if (pageContext.currentUser) { | ||
throw redirect('/') | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
apps/webapp/src/features/auth/pages/register.page.server.ts
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
apps/webapp/src/features/series/components/UserSeriesListPage/UserSeriesListPage.tsx
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
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
8 changes: 8 additions & 0 deletions
8
apps/webapp/src/features/series/pages/list/@status.page.route.ts
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { redirect } from 'vike/abort' | ||
import { type PageContext } from 'vike/types' | ||
|
||
export const guard = (pageContext: PageContext) => { | ||
if (!pageContext.currentUser) { | ||
throw redirect('/') | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
apps/webapp/src/features/series/pages/list/@status.page.server.ts
This file was deleted.
Oops, something went wrong.
13 changes: 4 additions & 9 deletions
13
apps/webapp/src/features/series/pages/list/index.page.server.ts
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,13 +1,8 @@ | ||
import { type PageContext } from '#/renderer/types' | ||
import { redirect } from 'vike/abort' | ||
import { type PageContext } from 'vike/types' | ||
|
||
export const onBeforeRender = ( | ||
pageContext: PageContext, | ||
): { pageContext?: Partial<PageContext> } | undefined => { | ||
export const guard = (pageContext: PageContext) => { | ||
if (!pageContext.currentUser) { | ||
return { | ||
pageContext: { | ||
redirectTo: '/', | ||
}, | ||
} | ||
throw redirect('/') | ||
} | ||
} |
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { type NormalizedCacheObject, type ApolloClient } from '@apollo/client' | ||
|
||
import { type AuthenticatedUser } from '#/features/auth' | ||
import { type Theme } from '#/utils/theme' | ||
|
||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace Vike { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
interface PageContext { | ||
apollo: ApolloClient<NormalizedCacheObject> | ||
apolloInitialState: NormalizedCacheObject | ||
currentUser?: AuthenticatedUser | ||
theme?: Theme | ||
|
||
exports: { | ||
documentProps?: { | ||
title?: string | ||
description?: string | ||
} | ||
} | ||
|
||
Page: (pageProps: PageProps) => JSX.Element | ||
pageProps?: PageProps | ||
} | ||
} | ||
} | ||
|
||
type PageProps = Record<string, unknown> | ||
|
||
export {} |
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
Oops, something went wrong.