Skip to content

Commit

Permalink
feat(): patch #1 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
fliptheweb committed Feb 23, 2023
1 parent dfbbb54 commit 08439b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
That version is patched by:
1. If there is an error during fetchUser - it won't thrown outside the module. In our code the error occurred because for unlogged user endpoint returns `false` instead of `{}`
2. Cookie strategy looks only for cookie existance to send an auth request, instead of token check + cookie in main repo (probably bug)

===================
<h1 align="center" >🔑 Auth Module</h1>
<p align="center">Zero-boilerplate authentication support for Nuxt.js!</p>

Expand Down
4 changes: 3 additions & 1 deletion src/schemes/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export class CookieScheme<
check(): SchemeCheck {
const response = { valid: false }

if (!super.check().valid) {
// Patch #2: Check if token is required (we don't use it) and skip condition
// otherwise it will always return false
if (this.options.token.required && !super.check().valid) {
return response
}

Expand Down
3 changes: 2 additions & 1 deletion src/schemes/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ export class LocalScheme<
})
.catch((error) => {
this.$auth.callOnError(error, { method: 'fetchUser' })
return Promise.reject(error)
// Patch #1: Do not thorwn reject outside auth module
// return Promise.reject(error)
})
}

Expand Down

0 comments on commit 08439b4

Please sign in to comment.