Last active
November 4, 2015 05:49
-
-
Save gregtap/f6923886a1835b30c242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import User from 'online-mobile/models/user'; | |
| export default Ember.Service.extend({ | |
| store: Ember.inject.service('store'), | |
| // websocket status. | |
| isConnected: false, | |
| // Our user. | |
| currentUser: function() { | |
| return this.get('store').peekRecord('user', 'me'); | |
| }.property(), | |
| // Update current user. | |
| setCurrentUser: function(userData) { | |
| this.get('store').push({ | |
| data: { | |
| id: 'me', | |
| type: 'user', | |
| attributes: { | |
| uuid: userData.uuid, | |
| firstName: userData['first_name'], | |
| lastName: userData['last_name'], | |
| externalId: userData['external_id'], | |
| avatarUrl: userData['avatar_url'], | |
| roleName: userData['role_name'], | |
| }, | |
| }, | |
| }); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment