1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 23:29:42 +02:00

Push a user into store when a session is created

This commit is contained in:
zinyando 2016-08-11 11:35:14 +02:00
parent 87f7631880
commit d47f1e11b8

View file

@ -22,6 +22,7 @@ const {
export default SimpleAuthSession.extend({ export default SimpleAuthSession.extend({
ajax: service(), ajax: service(),
appMeta: service(), appMeta: service(),
store: service(),
isMac: false, isMac: false,
isMobile: false, isMobile: false,
@ -37,7 +38,8 @@ export default SimpleAuthSession.extend({
user: computed('isAuthenticated', 'session.content.authenticated.user', function () { user: computed('isAuthenticated', 'session.content.authenticated.user', function () {
if (this.get('isAuthenticated')) { if (this.get('isAuthenticated')) {
let user = this.get('session.content.authenticated.user') || { id: '' }; let user = this.get('session.content.authenticated.user') || { id: '' };
return models.UserModel.create(user); let data = this.get('store').normalize('user', user);
return this.get('store').push({ data: data });
} }
}), }),