我正在尝试安装 rn-push-notifications,我需要 google play services 版本和 firebase 版本。你能帮我一下吗?
javascript react-native react-native-push-notification react-notifications
我使用react-toastify进行toast通知,但是当我的页面重定向到另一个页面时它不起作用。
mydata 无法保存到数据库。当我的页面没有重定向时它正在工作。
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const loginUser = async (e) => {
e.preventDefault();
const res = await fetch("/signin", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ email, password }),
});
const data = await res.json();
if (res.status === 422 || !res) {
warningAlert();
console.log(res);
console.log("Invalid Credentials")
} else {
successAlert();
dispatch({ type: "USER", payload: true });
// console.log(res);
history.push("/");
}
}
Run Code Online (Sandbox Code Playgroud)
以上代码用于登录。这里的通知不是在
else条件下工作,而是在条件下工作if。
上述警报
const successAlert = …Run Code Online (Sandbox Code Playgroud)