From dc893b0d5d64cace353bd998c11621e05439101f Mon Sep 17 00:00:00 2001 From: xmflsct Date: Mon, 30 Jan 2023 13:53:21 +0100 Subject: [PATCH] Reset when verification failed --- src/utils/api/helpers/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/api/helpers/index.ts b/src/utils/api/helpers/index.ts index 8edcb267..ff796526 100644 --- a/src/utils/api/helpers/index.ts +++ b/src/utils/api/helpers/index.ts @@ -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)