Refactored users/edit
This commit is contained in:
		
							parent
							
								
									b742ddbb51
								
							
						
					
					
						commit
						1dd0910ed1
					
				
					 13 changed files with 92 additions and 65 deletions
				
			
		|  | @ -2,19 +2,20 @@ import Ember from 'ember'; | |||
| import DS from 'ember-data'; | ||||
| import parseBase64 from '../utils/parse-base64'; | ||||
| 
 | ||||
| const { service } = Ember.inject; | ||||
| const { Service, computed, isEmpty, inject: { service } } = Ember; | ||||
| const { PromiseObject } = DS; | ||||
| 
 | ||||
| export default Ember.Service.extend({ | ||||
| export default Service.extend({ | ||||
|   session: service('session'), | ||||
|   store: service(), | ||||
| 
 | ||||
|   account: Ember.computed('session.data.authenticated.access_token', function() { | ||||
|   account: computed('session.data.authenticated.access_token', function() { | ||||
|     const token = this.get('session.data.authenticated.access_token'); | ||||
|     const claims = parseBase64(token); | ||||
|     const id = claims['sub']; | ||||
| 
 | ||||
|     if (!Ember.isEmpty(id)) { | ||||
|       return DS.PromiseObject.create({ | ||||
|     if (!isEmpty(id)) { | ||||
|       return PromiseObject.create({ | ||||
|         promise: this.get('store').findRecord('user', id), | ||||
|       }); | ||||
|     } | ||||
|  |  | |||
		Reference in a new issue
	
	 Matthew Dillon
						Matthew Dillon