try to authenticate request if logged in/ on pro

This commit is contained in:
Lisa P 2015-08-25 16:08:34 -04:00
parent dd09b105ee
commit 47d8951535
2 changed files with 9 additions and 2 deletions

View File

@ -7,7 +7,6 @@ Route = TravisRoute.extend
filter: { replace: true }
model: ->
apiEndpoint = config.apiEndpoint
console.log(@auth)
$.ajax(apiEndpoint + '/v3/repos?repository.active=true', {
# $.ajax(apiEndpoint + '/v3/#{params.owner}?include=user.repositories,organization.repositories,build.commit', {
headers: {

View File

@ -4,11 +4,19 @@
`import config from 'travis/config/environment'`
Route = TravisRoute.extend
deactivate: ->
@controllerFor('loading').set('layoutName', null)
model: (params) ->
$.get(config.apiEndpoint + "/v3/owner/#{params.owner}")
if @get('auth.signedIn')
$.get(config.apiEndpoint + "/v3/owner/#{params.owner}", {
headers: {
Authorization: "token #{@auth.token()}"
}
})
else
$.get(config.apiEndpoint + "/v3/owner/#{params.owner}")
beforeModel: ->
@controllerFor('loading').set('layoutName', 'simple')