Skip to content

Commit

Permalink
Fix auth error infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
delfrrr committed Dec 6, 2023
1 parent 95f97b6 commit 1192b2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Create .npmrc
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_GH_TOKEN }}" > .npmrc
echo "@dekart-xyz:registry=https://npm.pkg.github.com" >> .npmrc
- name: Set up QEMU
- name: Check out the repo
uses: actions/checkout@v2
- name: Create .npmrc
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_GH_TOKEN }}" > .npmrc
echo "@dekart-xyz:registry=https://npm.pkg.github.com" >> .npmrc
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
1 change: 1 addition & 0 deletions src/client/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function AppRedirect () {
}, [status, doNotAuthenticate])

if (status === 401 && doNotAuthenticate === false) {
// redirect to authentication endpoint from useEffect
return null
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/actions/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export function setError (err, transitive = true) {
}
}

export function setHttpError (status, message = '', doNotAuthenticate = false) {
return { type: setHttpError.name, status, message, doNotAuthenticate }
export function setHttpError (status, message = '') {
return { type: setHttpError.name, status, message}
}

export function setStreamError (code, msg) {
Expand Down
16 changes: 11 additions & 5 deletions src/client/reducers/rootReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,18 @@ function env (state = defaultEnv, action) {

function httpError (state = {}, action) {
switch (action.type) {
case setHttpError.name:
return {
status: action.status,
message: action.message,
doNotAuthenticate: action.doNotAuthenticate
case setHttpError.name: {
if (action.status === 401 && state.doNotAuthenticate) {
// just keep showing auth error, do not override it with other 401
return state
} else {
return {
status: action.status,
message: action.message,
doNotAuthenticate: false
}
}
}
case setRedirectState.name: {
const err = action.redirectState.getError()
if (err) {
Expand Down

0 comments on commit 1192b2e

Please sign in to comment.