javascript - Save data in localstorage of browers in ember simple auth -


i have used ember-simple-auth fb login.i able fetch fb's access_token , sending token server exchange of server token.this works fine , and able make transition user feed page.but problem facing first time user.i have show them onboarding screen before taking them feed screen.and next time can skip onboarding process them.

torii.js

export default torii.extend({   torii: service('torii'),    authenticate() {     return new rsvp.promise((resolve, reject) => {       this._super(...arguments).then((data) => {         console.log(data.accesstoken);         raw({           url:      'http://example.co.in/api/socialsignup/',           type:     'post',           datatype: 'json',           data:     { 'access_token':data.accesstoken,'provider':'facebook'}         }).then((response) => {           console.log(response.token);           resolve({             // jscs:disable requirecamelcaseoruppercaseidentifiers             access_token: response.token,             // jscs:enable requirecamelcaseoruppercaseidentifiers             provider: data.provider           });         }, reject);       }, reject);     });   } }); 

the response getting server this.

for first time user.

{access_token:'abcd...',signup_done:false} 

when signup_done false have show user onboarding screen , make post request server "http://example.co.in/api/post/signupdone"

for normal user

{access_token:'abcd...',singup_done:true} 

this time have move user thier feed screen skipping onboarding screen.

i want save singup_done server cookie or brower local storage ( not sure ).so can use value in handlebars,controller,model,component.i open other suggestion achieve simple method.please use code example.thanks in advance.

you can save data in session's data setting it:

this.get('session').set('data.signupdone', true);

that way signupdone persisted (also when session invalidated). of course if user logs in in browser data won't present anymore should store property in resource on server side instead.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -