1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Make error object as optional

This commit is contained in:
Zhiyuan Zheng
2022-05-17 23:18:49 +02:00
parent 4b3b222582
commit 02360c443f
5 changed files with 15 additions and 33 deletions

View File

@ -41,10 +41,10 @@ const netInfo = async (): Promise<{
}).then(res => res.body)
} catch (error: any) {
log('error', 'netInfo', 'local credential check failed')
if (error.status && error.status == 401) {
if (error?.status && error.status == 401) {
store.dispatch(removeInstance(instance))
}
return Promise.resolve({ corrupted: error.data.error })
return Promise.resolve({ corrupted: error.data?.error })
}
log('log', 'netInfo', 'local credential check passed')