-
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.
build(webapp): migrate to Vike v1 API
- Loading branch information
1 parent
9c2e8e3
commit e0188ec
Showing
30 changed files
with
80 additions
and
61 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { Config } from 'vike/types' | ||
|
||
export default { | ||
filesystemRoutingRoot: '/', | ||
} satisfies Config |
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,5 @@ | ||
import type { Config } from 'vike/types' | ||
|
||
export default { | ||
filesystemRoutingRoot: '/', | ||
} satisfies Config |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...pp/src/features/auth/pages/login.page.tsx → ...p/src/features/auth/pages/login/+Page.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,5 @@ | ||
import type { GuardSync } from 'vike/types' | ||
|
||
import { requireNoAuthentication } from '#/utils/redirect' | ||
|
||
export const guard: GuardSync = requireNoAuthentication() |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...src/features/auth/pages/register.page.tsx → ...rc/features/auth/pages/register/+Page.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,5 @@ | ||
import type { GuardSync } from 'vike/types' | ||
|
||
import { requireNoAuthentication } from '#/utils/redirect' | ||
|
||
export const guard: GuardSync = requireNoAuthentication() |
File renamed without changes.
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
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...res/series/pages/list/index.page.route.ts → .../src/features/series/pages/list/+guard.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,10 +1,10 @@ | ||
import { redirect } from 'vike/abort' | ||
import type { GuardSync } from 'vike/types' | ||
|
||
import { requireAuthentication } from '#/utils/redirect' | ||
|
||
export const guard: GuardSync = (pageContext) => { | ||
if (!pageContext.currentUser) { | ||
throw redirect('/') | ||
} | ||
requireAuthentication()(pageContext) | ||
|
||
throw redirect('/series/list/in-progress') | ||
} |
8 changes: 0 additions & 8 deletions
8
apps/webapp/src/features/series/pages/list/@status.page.route.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
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,5 @@ | ||
import type { GuardSync } from 'vike/types' | ||
|
||
import { requireAuthentication } from '#/utils/redirect' | ||
|
||
export const guard: GuardSync = requireAuthentication() |
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
File renamed without changes
File renamed without changes.
File renamed without changes
2 changes: 1 addition & 1 deletion
2
apps/webapp/src/pages/about/index.page.tsx → apps/webapp/src/pages/about/+Page.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
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
import type { GuardSync } from 'vike/types' | ||
|
||
import { requireNoAuthentication } from '#/utils/redirect' | ||
|
||
export const guard: GuardSync = requireNoAuthentication() |
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,16 @@ | ||
import type { Config } from 'vike/types' | ||
|
||
export default { | ||
passToClient: [ | ||
'pageProps', | ||
'routeParams', | ||
'documentProps', | ||
'apolloInitialState', | ||
'currentUser', | ||
'theme', | ||
], | ||
// Enable client-side routing | ||
// https://vike.dev/clientRouting | ||
clientRouting: true, | ||
hydrationCanBeAborted: true, | ||
} satisfies Config |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { redirect } from 'vike/abort' | ||
import type { GuardSync } from 'vike/types' | ||
|
||
const UNAUTHENTICATED_DEFAULT_URL = '/' | ||
const AUTHENTICATED_DEFAULT_URL = '/series/list/in-progress' | ||
|
||
export const requireAuthentication = | ||
(redirectTo = UNAUTHENTICATED_DEFAULT_URL): GuardSync => | ||
(pageContext) => { | ||
if (!pageContext.currentUser) { | ||
throw redirect(redirectTo) | ||
} | ||
} | ||
|
||
export const requireNoAuthentication = | ||
(redirectTo = AUTHENTICATED_DEFAULT_URL): GuardSync => | ||
(pageContext) => { | ||
if (pageContext.currentUser) { | ||
throw redirect(redirectTo) | ||
} | ||
} |