diff --git a/cmd/ui/src/utils.ts b/cmd/ui/src/utils.ts index 465999d6e..fdb6579f3 100644 --- a/cmd/ui/src/utils.ts +++ b/cmd/ui/src/utils.ts @@ -25,6 +25,8 @@ import { isLink, isNode } from 'src/ducks/graph/utils'; import { Glyph } from 'src/rendering/programs/node.glyphs'; import { store } from 'src/store'; +const IGNORE_401_LOGOUT = ['/api/v2/login', '/api/v2/logout', '/api/v2/features'] + export const getDatesInRange = (startDate: Date, endDate: Date) => { const date = new Date(startDate.getTime()); @@ -74,12 +76,10 @@ export const initializeBHEClient = () => { (error) => { if (error?.response) { - if ( - error?.response?.status === 401 && - error?.response?.config.url !== '/api/v2/login' && - error?.response?.config.url !== '/api/v2/logout' - ) { - throttledLogout(); + if (error?.response?.status === 401) { + if (IGNORE_401_LOGOUT.includes(error?.response?.config.url) === false) { + throttledLogout(); + } } else if ( error?.response?.status === 403 && !error?.response?.config.url.match('/api/v2/bloodhound-users/[a-z0-9-]+/secret')