ducky/web

Paddy 2015-07-07 Parent:791aec3eb17b Child:bc1478742a50

18:9b97c908a706 Go to Latest

ducky/web/src/models/profile.js

Fix bug in oauth-refresh, update for hosted path. Our nginx-fronted path has changed, so update the helper to hit the right URL. Also, fix a bug that would cause every failed request to be retried, which was suboptimal.

History
paddy@0 1 import Model from 'ampersand-model'
paddy@12 2 import refresh from '../helpers/oauth-refresh'
paddy@0 3
paddy@0 4 export default Model.extend({
paddy@0 5 props: {
paddy@0 6 'id': 'string',
paddy@0 7 'name': 'string',
paddy@0 8 'created': 'date',
paddy@0 9 'last_seen': 'date',
paddy@0 10 },
paddy@12 11 sync: refresh.Sync,
paddy@12 12 parse (attrs) {
paddy@12 13 if (attrs.profiles && attrs.profiles.length == 1) {
paddy@12 14 attrs = attrs.profiles[0]
paddy@12 15 }
paddy@12 16 return attrs
paddy@12 17 },
paddy@12 18 ajaxConfig () {
paddy@12 19 return {
paddy@12 20 headers: {
paddy@12 21 'Authorization': 'Bearer '+app.me.access_token,
paddy@12 22 'Accept': 'application/json',
paddy@12 23 }
paddy@12 24 }
paddy@12 25 },
paddy@0 26 })