Skip to content

Commit

Permalink
fix: handle both unauthorized and forbidden on sign-in
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanDavlyatshin committed Dec 12, 2023
1 parent 8879370 commit 08627ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/background/backend-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async function setupAxios(backendUrl: string) {
axios.interceptors.response.use(
undefined, // (response) => response,
async (error) => {
if (error.response && error.response.status === 401) {
if (error.response && (error.response.status === 401 || error.response.status === 403)) {
// TODO update token & retry
// see https://github.com/axios/axios/issues/934
// - note the comments
Expand Down
2 changes: 1 addition & 1 deletion src/forms/connection-form/connection-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ConnectionForm = () => {
await localStorageUtil.save({ backendAddress, token })
} catch (e: any) {
if (e.isAxiosError) {
if (e.response.status == 401) {
if (e.response.status == 401 || e.response.status == 403) {
setError("Invalid username or password")
} else {
console.log('Sign in attempt failed. Reason:',e)
Expand Down

0 comments on commit 08627ed

Please sign in to comment.