Я хочу перенаправить на обещание, когда оно в 'тогда'. Но это также не работает с history.push()
и Redirect
. Есть ли другой способ сделать это?
Вот функция:
let submit = (e: any) => {
e.preventDefault();
if (userData.password === confirmPassword) {
userService.postRegister(userData)
.then(function (data) {
store.addNotification({
title: "Succès",
message: "Votre inscription a été prise en compte",
insert:'top',
type: 'success',
container: 'top-right',
animationIn: ["animated", "fadeIn"],
animationOut: ["animated", "fadeOut"],
dismiss: {
duration: 5000,
}
})
console.log("test");
history.push("/signin");
})
.catch(function (err) {
store.addNotification({
title: "Erreur",
message: "L'inscription n'a pas pu aboutir",
insert:'top',
type: 'danger',
container: 'top-right',
animationIn: ["animated", "fadeIn"],
animationOut: ["animated", "fadeOut"],
dismiss: {
duration: 5000,
}
})
});