I'm using a non-ssr plugin to check something before redirecting, the only way I can get it to fire is but wrapping a Promise around the function and leaving out the resolve() within the Promise, the url updates, but the redirected page doesn't render, just the previous page...
nuxt.config.js
plugins: [
{ src: '~/plugins/auth', ssr: false }
]
plugins/auth.js
export default ({ store, redirect, route }) => {
// doesn't work
redirect('/admin/login')
// doesn't work
return new Promise((resolve, reject) => {
redirect('/admin/login')
resolve()
})
// works, but only the url updates, the page doesn't render
return new Promise((resolve, reject) => {
redirect('/admin/login')
})
})
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1793">#c1793</a>)</em></sub></div>