feat: prefered language
This commit is contained in:
+14
-15
@@ -16,14 +16,24 @@ export default ({ navigation }) => {
|
||||
}, [])
|
||||
|
||||
const userRouting = async () => {
|
||||
try {
|
||||
const uid = firebase.auth().currentUser?.uid
|
||||
if (!uid) throw new Error('No user')
|
||||
const uid = firebase.auth().currentUser?.uid
|
||||
|
||||
if (!uid) {
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [{ name: Routes.LandingPage }],
|
||||
})
|
||||
setIsFullyLoaded(true)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const userSnap = await usersRef.doc(uid).get()
|
||||
const user = userSnap?.data() || {}
|
||||
if (userSnap.exists) setCurrentUserData(user)
|
||||
|
||||
} catch (error) {
|
||||
console.warn('Splash: unable to load user profile', error)
|
||||
} finally {
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [
|
||||
@@ -36,17 +46,6 @@ export default ({ navigation }) => {
|
||||
},
|
||||
],
|
||||
})
|
||||
} catch (error) {
|
||||
// Pas d'utilisateur connecté => accueil avec tab bar
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [
|
||||
{
|
||||
name: Routes.BottomTab,
|
||||
},
|
||||
],
|
||||
})
|
||||
} finally {
|
||||
setIsFullyLoaded(true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user