check if user is signed in

This commit is contained in:
Lisa P 2015-08-26 11:33:19 -04:00
parent d6fa74c8f6
commit 978b35b6ca
2 changed files with 8 additions and 11 deletions

View File

@ -9,11 +9,10 @@ Route = TravisRoute.extend
@controllerFor('loading').set('layoutName', null)
model: (params) ->
$.ajax(config.apiEndpoint + "/v3/owner/#{params.owner}", {
headers: {
Authorization: "token #{@auth.token()}"
}
})
options = {}
if @get('auth.signedIn')
options.headers = { Authorization: "token #{@auth.token()}" }
$.ajax(config.apiEndpoint + "/v3/owner/#{params.owner}", options)
beforeModel: ->
@controllerFor('loading').set('layoutName', 'simple')

View File

@ -10,11 +10,9 @@ Route = TravisRoute.extend
"#{model.name}"
model: (params, transition) ->
$.ajax(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active", {
headers: {
Authorization: "token #{@auth.token()}"
},
type: "GET"
})
options = {}
if @get('auth.signedIn')
options.headers = { Authorization: "token #{@auth.token()}" }
$.ajax(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active", options)
`export default Route`