Skip to content

Commit

Permalink
fix(#896): set rawRefreshToken default value (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix-ru authored Sep 5, 2024
1 parent 3a5fc50 commit ccf7ba0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/composables/local/useAuthState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ export function useAuthState(): UseAuthStateReturn {
secure: config.refresh.token.secureCookieAttribute,
httpOnly: config.refresh.token.httpOnlyCookieAttribute
})

// Set default value if `useState` returned `null`
// https://github.com/sidebase/nuxt-auth/issues/896
if (rawRefreshToken.value === null) {
rawRefreshToken.value = _rawRefreshTokenCookie.value
}

watch(rawRefreshToken, () => {
_rawRefreshTokenCookie.value = rawRefreshToken.value
})
Expand Down

0 comments on commit ccf7ba0

Please sign in to comment.