Skip to content

Commit

Permalink
Read AppContext instead of SSRContext in router
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinovantes committed Oct 6, 2022
1 parent c684366 commit 6a5eb81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions example/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createMemoryHistory, createRouter, createWebHistory, type Router } from 'vue-router'
import type { SSRContext } from '@vue/server-renderer'
import type { AppContext } from './AppContext'

// ----------------------------------------------------------------------------
// Router
// ----------------------------------------------------------------------------

export async function createAppRouter(ssrContext?: SSRContext): Promise<Router> {
export async function createAppRouter(ssrContext?: AppContext): Promise<Router> {
const router = createRouter({
history: ssrContext !== undefined
? createMemoryHistory()
Expand All @@ -31,7 +31,7 @@ export async function createAppRouter(ssrContext?: SSRContext): Promise<Router>
],
})

if (typeof ssrContext?.url === 'string') {
if (ssrContext?.url) {
await router.push(ssrContext.url)
}

Expand Down

0 comments on commit 6a5eb81

Please sign in to comment.