ducky/web
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.
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 })