diff --git a/.eslintrc.js b/.eslintrc.js
index 0f3f39ca..a6cf11b9 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,5 +1,9 @@
module.exports = {
root: true,
extends: '@react-native-community',
- rules: {},
-};
+ rules: {
+ semi: 0,
+ curly: 0,
+ 'no-shadow': 'off',
+ },
+}
diff --git a/android/.project b/android/.project
new file mode 100644
index 00000000..8804c0eb
--- /dev/null
+++ b/android/.project
@@ -0,0 +1,28 @@
+
+
+ taskme
+ Project android created by Buildship.
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectnature
+
+
+
+ 1630909588189
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/android/app/.project b/android/app/.project
new file mode 100644
index 00000000..440489d4
--- /dev/null
+++ b/android/app/.project
@@ -0,0 +1,34 @@
+
+
+ app
+ Project app created by Buildship.
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
+
+
+
+ 1630909588124
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index ea1403dd..da4f0a63 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -500,7 +500,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
- FBReactNativeSpec: 09a9b45481cf51e2fc98dd8dc8432607e43e1c52
+ FBReactNativeSpec: f92e05dd7f112a9a27a69b51545ca9e9c74439ff
Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c
@@ -549,4 +549,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 10a43cb7dc544fdabb001116ec92f9d67b11e153
-COCOAPODS: 1.10.2
+COCOAPODS: 1.10.1
diff --git a/src/api/http.service.ts b/src/api/http.service.ts
index fb1e641d..7d522496 100644
--- a/src/api/http.service.ts
+++ b/src/api/http.service.ts
@@ -4,6 +4,8 @@ import { config } from '@/config'
import { GlobalContainerService } from '@/services/system'
import Storage from 'react-native-expire-storage'
import { AuthService } from '@/services/domain'
+import { SetIsForbidden } from '@/store/shared'
+import { simpleDispatch } from '@/store/store-helpers'
const store = () => GlobalContainerService.get('store')
@@ -40,10 +42,14 @@ const request = async (func: Function): Promise> => {
let response = await func()
return response as any as AxiosResponse
} catch (e: any) {
- if (e.response.status === 401) {
+ console.log('CAUGHT IN REQ', e.response?.data.statusCode)
+ if (e.response?.data?.statusCode === 401) {
await AuthService.refreshSession()
return (await func()) as any as AxiosResponse
}
+ if (e.response?.data?.statusCode === 403) {
+ simpleDispatch(new SetIsForbidden({ isForbidden: true }))
+ }
throw e
}
}
diff --git a/src/modules/auth/hooks/use-authorization.hook.ts b/src/modules/auth/hooks/use-authorization.hook.ts
index 37a393df..eafe9e3a 100644
--- a/src/modules/auth/hooks/use-authorization.hook.ts
+++ b/src/modules/auth/hooks/use-authorization.hook.ts
@@ -1,12 +1,24 @@
import { AuthService } from '@/services/domain'
-import { useState } from 'react'
+import { ExceptionKeys, getMessageByExceptionKey } from '@/shared'
+import { selectIsForbidden } from '@/store/shared'
+import { useEffect, useState } from 'react'
+import { useSelector } from 'react-redux'
export const useAuthorization = () => {
const [isSent, setIsSent] = useState(false)
const [isConfirmed, setIsConfirmed] = useState(false)
- const [error, setError] = useState(null)
+ const [error, setError] = useState(null)
+ const isForbidden = useSelector(selectIsForbidden)
- const clearError = () => setError(false)
+ const clearError = () => setError(null)
+
+ const setFirbiddenError = () => {
+ setError(getMessageByExceptionKey(ExceptionKeys.Forbidden))
+ }
+
+ useEffect(() => {
+ if (isForbidden) setFirbiddenError()
+ }, [isForbidden])
const sendCode = async (phoneNumber: string) => {
try {
@@ -15,7 +27,13 @@ export const useAuthorization = () => {
setIsSent(true)
clearError()
} catch (e: any) {
- setError(e.response?.data)
+ console.log('ERROR', e.message)
+ if (e.response?.data.statusCode === 403) {
+ setFirbiddenError()
+ return
+ }
+
+ setError(getMessageByExceptionKey(e.response?.data?.key))
}
}
@@ -25,7 +43,11 @@ export const useAuthorization = () => {
setIsConfirmed(true)
clearError()
} catch (e: any) {
- setError(e.response?.data)
+ if (e.response?.data.statusCode === 403) {
+ setFirbiddenError()
+ return
+ }
+ setError(getMessageByExceptionKey(e.response?.data?.key))
}
}
diff --git a/src/modules/auth/screens/confirm-code.screen.tsx b/src/modules/auth/screens/confirm-code.screen.tsx
index 48df8877..4478bc96 100644
--- a/src/modules/auth/screens/confirm-code.screen.tsx
+++ b/src/modules/auth/screens/confirm-code.screen.tsx
@@ -3,7 +3,6 @@ import {
$size,
AuthLayout,
Button,
- getMessageByExceptionKey,
getTheme,
ImageComponent,
NavigationModuleKey,
@@ -79,13 +78,14 @@ export const ConfirmCode = () => {
name: 'lock-1',
color: getTheme().iconComponent.$primaryColor,
}}
- error={getMessageByExceptionKey(error?.key)}
+ error={error}
/>