'Render fetching data after login - [React - Javascript]
I had a problem when I try to run my project the Drawer navigation invoked before I loged in How can I ascyn this operation by rendering data after the login. if someone have an idea please share it I'll be glad. here is my code bellow :
Drawer.js:
useLayoutEffect(() => {
getCurrentUser()
}, [props])
const getCurrentUser = async() => {
try {
await AsyncStorage.getItem("userName", (err, result) => {
setEmail(result)
});
await AuthService.getCurrentUser(email)
.then(response => {
setItems(response.data);...
App.js:
<PaperProvider>
<NavigationContainer>
<Drawer.Navigator
initialRouteName="LoginScreen"
screenOptions={{
headerShown: false,
headerTransparent:true
}}
drawerContent={props => <DrawerContent {...props} />}>....
The console error :
Request failed with status code 404 at node_modules\axios\lib\core\createError.js:16:14 in createError at node_modules\axios\lib\core\settle.js:17:22 in settle
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
