ducky/web

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

19:6b7037b4cbe7 Go to Latest

ducky/web/src/models/profile.js

Update to hosted URL, use oauth-refresh in profiles. When syncing the profiles, use our oauth-refresh sync helper, so it won't fail because of an expired OAuth token. Also, update our URL to use the nginx-fronted URL.

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 })