Quantcast
Viewing all articles
Browse latest Browse all 4827

this.get('route').transitionTo with values to a different route

@SowmyaManohar wrote:

Hi am trying to pass the userId returned from api to forcePassword page, so from that page i can form new data to api with just pwd from user, I am struggling to pass it to the next route. Tried as query parameters in transitionTo , but the page is not transitioning , My code

let loginPromise = .ajax({ url: this.host + "/login", type: "POST", data: data }) .then( result => { if(result.new){ alert("here"+ result.userId); router.transitionTo(`forcepassword/{result.userId}); //this.transitionToRoute(/forcepassword/${result.userId}`); //router.transitionTo(‘forcepassword’,result.userId)// this throws error saying needs model, but throughout our app we have maintained models from api } if(result.token){ localStorage.setItem(ENV.TOKEN_KEY, result.token); router.transitionTo(‘application’); } }, error => { alert(“Invalid credentials”); //console.log(error.responseText) } )

router.js : this.route(‘forcepassword’, { path: ‘/forcepassword/:user_id’ });

when using just transitionTo it is working . without value being passed

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles