I am trying to do this function where once the user successfully lands on the page, it will update their details in firebase, and then right away go to the landing page. but I cannot get to the landing page. here's what I have, and all the different methods ive tried:
const successPage = () => {
firebase.auth().onAuthStateChanged((user) => {
if(user) {
// console.log("profile.js " + user.uid)
// userID = user.uid
console.log("calling success page : " + user.uid)
firestore.collection("profiledata").doc(user.uid).update({
accountStatus: "active"
}).then (() => {
// window.open(routes.LANDING)
<Route path="/"></Route>
// window.location.href(routes.LANDING)
// history.push(routes.LANDING)
})
}
})
return (
<input type="hidden"></input>
);
}
it all works, no errors other then the error that it doesn't like history.push
, or this.props.history.push
, or window.location.href
... the only thing it likes is window.open
, but I cant use this because it opens a new window! Plz help :)