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