chore(fix): fixes sync response not correctly identifying all errors (#2346)
This commit is contained in:
@@ -12,7 +12,7 @@ import Icon from '@/Components/Icon/Icon'
|
||||
import IconButton from '@/Components/Button/IconButton'
|
||||
import AdvancedOptions from './AdvancedOptions'
|
||||
import HorizontalSeparator from '../Shared/HorizontalSeparator'
|
||||
import { isErrorResponse } from '@standardnotes/snjs'
|
||||
import { getErrorFromErrorResponse, isErrorResponse } from '@standardnotes/snjs'
|
||||
|
||||
type Props = {
|
||||
viewControllerManager: ViewControllerManager
|
||||
@@ -99,7 +99,7 @@ const SignInPane: FunctionComponent<Props> = ({ application, viewControllerManag
|
||||
.signIn(email, password, isStrictSignin, isEphemeral, shouldMergeLocal)
|
||||
.then((response) => {
|
||||
if (isErrorResponse(response)) {
|
||||
throw new Error(response.data?.error.message)
|
||||
throw new Error(getErrorFromErrorResponse(response).message)
|
||||
}
|
||||
viewControllerManager.accountMenuController.closeAccountMenu()
|
||||
})
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { ViewControllerManager } from '@/Controllers/ViewControllerManager'
|
||||
import { SNApplication, SessionStrings, UuidString, SessionListEntry, isErrorResponse } from '@standardnotes/snjs'
|
||||
import {
|
||||
SNApplication,
|
||||
SessionStrings,
|
||||
UuidString,
|
||||
SessionListEntry,
|
||||
isErrorResponse,
|
||||
getErrorFromErrorResponse,
|
||||
} from '@standardnotes/snjs'
|
||||
import { FunctionComponent, useState, useEffect, useRef, useMemo } from 'react'
|
||||
import { WebApplication } from '@/Application/WebApplication'
|
||||
import { observer } from 'mobx-react-lite'
|
||||
@@ -64,9 +71,10 @@ function useSessions(
|
||||
if (!response) {
|
||||
setSessions(sessionsBeforeRevoke)
|
||||
} else if (isErrorResponse(response)) {
|
||||
if (response.data?.error.message) {
|
||||
setErrorMessage(response.data?.error.message || 'An unknown error occured while revoking the session.')
|
||||
}
|
||||
setErrorMessage(
|
||||
getErrorFromErrorResponse(response).message || 'An unknown error occured while revoking the session.',
|
||||
)
|
||||
|
||||
setSessions(sessionsBeforeRevoke)
|
||||
} else {
|
||||
setSessions(sessions.filter((session) => session.uuid !== uuid))
|
||||
|
||||
Reference in New Issue
Block a user