Reset when verification failed

This commit is contained in:
xmflsct 2023-01-30 13:53:21 +01:00
parent 4aa96ba2bd
commit dc893b0d5d
1 changed files with 8 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import * as Sentry from '@sentry/react-native'
import { setGlobalStorage } from '@utils/storage/actions'
import chalk from 'chalk'
import Constants from 'expo-constants'
import { Platform } from 'react-native'
import parse from 'url-parse'
import { GLOBAL } from '../../../App'
const userAgent = {
'User-Agent': `tooot/${Constants.expoConfig?.version} ${Platform.OS}/${Platform.Version}`
@ -18,6 +20,12 @@ const handleError =
} | void
) =>
(error: any) => {
if (GLOBAL.connect) {
if (error?.response?.status == 403 && error?.response?.data == 'connect_blocked') {
GLOBAL.connect = false
setGlobalStorage('app.connect', false)
}
}
const shouldReportToSentry = config && (config.captureRequest || config.captureResponse)
shouldReportToSentry && Sentry.setContext('Error object', error)