ducky/web

Paddy 2015-06-30 Parent:99a43a6d1d30 Child:275a83e4c02e

13:d51e39bf909c Go to Latest

ducky/web/src/main.js

Update our profiles collection to use ampersand-rest-collection. Use ampersand-rest-collection instead of ampersand-collection, so we can take advantage of the excellent "getOrFetch" function to fall back on the server when looking for a member of the collection that isn't downloaded yet. Also, use the correct Authorization header when making profile collection requests. Finally, if the profile collection requests fail due to an expired access token, use the refresh token to acquire a new access token, then retry the request.

History
1 import app from 'ampersand-app'
2 import Router from './router'
3 import Profiles from './models/profiles'
4 import Me from './models/me'
5 import normalize from 'normalize.css/normalize.css'
6 import styles from './styles/main.scss'
8 window.app = app.extend({
9 init () {
10 this.profiles = new Profiles()
11 this.me = new Me()
12 this.router = new Router()
13 this.router.history.start({ pushState: true })
14 }
15 })
17 app.init()