diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/helpers.jsx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/helpers.jsx b/utils/helpers.jsx index 9e130dc..62d740c 100644 --- a/utils/helpers.jsx +++ b/utils/helpers.jsx @@ -2,7 +2,8 @@ import AsyncStorage from '@react-native-async-storage/async-storage' import { Alert } from 'react-native'; import { login, getNote, editNote, createNote, removeNote } from './api' -export const handleLogin = async ({ email, password, setSession, showError }) => { +export const handleLogin = async ({ email, password, setSession, setLoading, showError }) => { + setLoading(true) try { const response = await login({ email, password }) const cookies = response.headers?.map?.['set-cookie'] @@ -12,6 +13,7 @@ export const handleLogin = async ({ email, password, setSession, showError }) => setSession({ ...data, cookies }) } } catch(e) { + setLoading(false) showError('Error while logging in') } } |