jeudi 2 janvier 2020

Store Rails Json response in ember

I am working on authentication of a user .

currently i am posting a session with username and password . which will be sent to rails bcrypt for authentication ,if authentication is true then this will return a json of user object .

how will i grab this user in ember so that i can store it in my service .

Login Function :

login(user) {
    console.log("this is working ")

    //this.get('sessionaccount').login(user)

    this.store.createRecord('session', {
        email: this.currentModel.email,
        password: this.currentModel.password
    }).save().then(function(data) {
        console.log(data.id) 
        this.id = data.id
        this.get('sessionaccount').login(data)
    });
}



Aucun commentaire:

Enregistrer un commentaire