Skip to content

Commit

Permalink
bugfix 548 / fix for invalid user token (#611)
Browse files Browse the repository at this point in the history
* fix for invalid user token

* update lock file

* updated dependencies

* updated dependencies

---------

Co-authored-by: PhotoNomad0 <[email protected]>
  • Loading branch information
PhotoNomad0 and PhotoNomad0 authored Dec 7, 2023
1 parent c6612ba commit bd4a646
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"react-icons": "^4.8.0",
"regenerator-runtime": "^0.13.7",
"resource-workspace-rcl": "2.1.4",
"scripture-resources-rcl": "5.5.8",
"scripture-resources-rcl": "5.5.9",
"scripture-tsv": "0.4.0",
"single-scripture-rcl": "3.4.17",
"tailwindcss": "^2.0.4",
Expand Down
13 changes: 9 additions & 4 deletions src/context/AuthContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ export default function AuthContextProvider(props) {
const httpCode = response?.status || 0

if (httpCode !== 200) {
console.log(`TranslationSettings - error fetching user info, status code ${httpCode}`)
console.log(`getAuth() - error fetching user info, status code ${httpCode}`)

if (unAuthenticated(httpCode)) {
console.log(`TranslationSettings - user not authenticated, going to login`)
console.error(`getAuth() - user not authenticated, going to login`)
logout()
} else {
processError(null, httpCode)
}
}
}).catch(e => {
console.warn(`TranslationSettings - hard error fetching user info, error=`, e)
processError(e)
if (e.toString().includes('401')) { // check if 401 code in exception
console.error(`getAuth() - user token expired`)
logout()
} else {
console.warn(`getAuth() - hard error fetching user info, error=`, e)
processError(e)
}
})
}
return auth
Expand Down
26 changes: 13 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2421,9 +2421,9 @@
"@types/react" "^17"

"@types/react-dom@^17.0.0":
version "17.0.25"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5"
integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA==
version "17.0.22"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.22.tgz#34317e08be27b33fa9e7cdb56125b22538261bad"
integrity sha512-wHt4gkdSMb4jPp1vc30MLJxoWGsZs88URfmt3FRXoOEYrrqK3I8IuZLE/uFBb4UT6MRfI0wXFu4DS7LS0kUC7Q==
dependencies:
"@types/react" "^17"

Expand Down Expand Up @@ -2467,9 +2467,9 @@
csstype "^3.0.2"

"@types/react@^17.0.0":
version "17.0.71"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.71.tgz#3673d446ad482b1564e44bf853b3ab5bcbc942c4"
integrity sha512-lfqOu9mp16nmaGRrS8deS2Taqhd5Ih0o92Te5Ws6I1py4ytHBcXLqh0YIqVsViqwVI5f+haiFM6hju814BzcmA==
version "17.0.69"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.69.tgz#245a0cf2f5b0fb1d645691d3083e3c7d4409b98f"
integrity sha512-klEeru//GhiQvXUBayz0Q4l3rKHWsBR/EUOhOeow6hK2jV7MlO44+8yEk6+OtPeOlRfnpUnrLXzGK+iGph5aeg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
Expand Down Expand Up @@ -9877,10 +9877,10 @@ schema-utils@^3.0.0:
ajv "^6.12.5"
ajv-keywords "^3.5.2"

[email protected].8:
version "5.5.8"
resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.8.tgz#edca70cb18f8c02b1c9c195a43bb3e8044fa6a09"
integrity sha512-RC82kGdA8jaclxwABRXFJkw9Bh5Ig3juBJY+vig8qsVLEU6EiHSuB5htz8BxkNPVUw7y5wpxxJeCb0rEATmEJA==
[email protected].9:
version "5.5.9"
resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.9.tgz#a82ec412b92e4b64b3e75e220db8577410badb83"
integrity sha512-riVKnzK3xyQO+YSXIz8N4am2cz6WTcNPjoZNF36bo2mFlDPSzCE2nbH48pvMiy0cxwvzfmScuvJcwbbqR5Na9w==
dependencies:
bible-reference-range "^1.1.0"
deep-freeze "^0.0.1"
Expand Down Expand Up @@ -11055,9 +11055,9 @@ typedarray-to-buffer@^3.1.5:
is-typedarray "^1.0.0"

typescript@^5.2.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43"
integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==

ua-parser-js@^0.7.30:
version "0.7.34"
Expand Down

0 comments on commit bd4a646

Please sign in to comment.