Skip to content

Commit

Permalink
fix: tokenStorage priority over config level token
Browse files Browse the repository at this point in the history
  • Loading branch information
Diizzayy committed Oct 25, 2022
1 parent b902c2d commit f374b2e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default defineNuxtPlugin((nuxtApp) => {

const reqOpts = defu(nuxtApp._gqlState.value?.[name]?.options || {}, { headers: {} })

token.value ??= reqOpts?.token?.value || v?.token?.value
token.value ??= reqOpts?.token?.value

if (!token.value && typeof v.tokenStorage === 'object') {
if (v.tokenStorage?.mode === 'cookie') {
Expand All @@ -62,6 +62,8 @@ export default defineNuxtPlugin((nuxtApp) => {
}
}

token.value ??= v?.token?.value

if (token.value) {
token.value = token.value.trim()

Expand Down

0 comments on commit f374b2e

Please sign in to comment.