我正在尝试将用户导航到主屏幕,但导航不起作用。它显示登录成功但未导航到主屏幕的警报是我的代码...
axios.post('/api_workreap/wp-json/api/v1/user/do_login', {
username: username,
password: password
})
.then((response) => {
console.log(JSON.stringify(response.data.type));
if(response.data.type == "success"){
alert("Login Successfully");
// this.props.navigation.navigate("/src/Home/home.js");
NavigationActions.navigate({ routeName: 'home' })
}else if(response.data.type == "error"){
alert("Incorrect Detail");
}
})
.catch((error) => {
console.log( JSON.stringify(response));
});