Skip to content

Commit

Permalink
Merge pull request #1157 from zhx828/hotfix-2
Browse files Browse the repository at this point in the history
Do not reload the page when authentication endpoint failed
  • Loading branch information
zhx828 authored Sep 25, 2024
2 parents f96b287 + 7a81790 commit 7b15ec3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/webapp/app/config/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ export enum PAGE_ROUTE {
ACCOUNT_ACTIVE_TRIAL_FINISH = '/account/active-trial/finish',
}

export enum API_ROUTE {
AUTHENTICATE = '/api/authenticate',
}

export enum TABLE_COLUMN_KEY {
HUGO_SYMBOL = 'HUGO_SYMBOL',
ALTERATION = 'ALTERATION',
Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getPublicWebsiteToken,
getStoredRecaptchaToken,
} from 'app/indexUtils';
import { UNAUTHORIZED_ALLOWED_PATH } from 'app/config/constants';
import { API_ROUTE, UNAUTHORIZED_ALLOWED_PATH } from 'app/config/constants';
import { AppConfig, AppProfile } from 'app/appConfig';

assignPublicToken();
Expand Down Expand Up @@ -79,6 +79,8 @@ superagent.Request.prototype.end = function (callback) {
AppConfig.serverConfig.token &&
AppConfig.serverConfig.appProfile === AppProfile.PROD &&
response.req &&
// we do not reload the page when the /api/authenticate failed
response.req.url !== API_ROUTE.AUTHENTICATE &&
UNAUTHORIZED_ALLOWED_PATH.some(path =>
window.location.pathname.endsWith(path)
)
Expand Down

0 comments on commit 7b15ec3

Please sign in to comment.