fix(nuxt): respect navigateTo options using server middleware in server-side (#5145)

This commit is contained in:
Daniel Roe 2022-06-01 00:09:32 +02:00 committed by GitHub
parent 1e8fba8378
commit 1fda73267a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,8 @@ export const navigateTo = (to: RouteLocationRaw, options: NavigateToOptions = {}
if (!to) {
to = '/'
}
if (isProcessingMiddleware()) {
// Early redirect on client-side since only possible option is redirectCode and not applied
if (process.client && isProcessingMiddleware()) {
return to
}
const router = useRouter()