mirror of
https://github.com/bitinflow/nuxt-oauth.git
synced 2026-03-13 13:45:59 +00:00
Update plugin.ts
This commit is contained in:
@@ -74,7 +74,7 @@ export default defineNuxtPlugin(() => {
|
|||||||
addRouteMiddleware('auth', async (to) => {
|
addRouteMiddleware('auth', async (to) => {
|
||||||
const {user, authConfig, setBearerToken, setRefreshToken} = await useAuth()
|
const {user, authConfig, setBearerToken, setRefreshToken} = await useAuth()
|
||||||
|
|
||||||
if (to.path === authConfig.redirect.callback) {
|
if (to.path === authConfig.redirect.callback || to.path === authConfig.redirect.callback + '/') {
|
||||||
const queryParams = new URLSearchParams(to.query.toString());
|
const queryParams = new URLSearchParams(to.query.toString());
|
||||||
if (queryParams.has('error')) {
|
if (queryParams.has('error')) {
|
||||||
return navigateTo(authConfig.redirect.login)
|
return navigateTo(authConfig.redirect.login)
|
||||||
|
|||||||
Reference in New Issue
Block a user