diff --git a/app/modules/zoo-api/zooapi.factory.js b/app/modules/zoo-api/zooapi.factory.js index d84592e..612dba3 100644 --- a/app/modules/zoo-api/zooapi.factory.js +++ b/app/modules/zoo-api/zooapi.factory.js @@ -6,7 +6,7 @@ require('./zooapi.module.js') var ApiClient = require('panoptes-client/lib/api-client'); var OAuth = require('panoptes-client/lib/oauth') // @ngInject -function zooAPI(zooAPIConfig) { +function zooAPI(zooAPIConfig, authFactory) { ApiClient.beforeEveryRequest = function() { return OAuth.checkBearerToken() .then(function (token) { @@ -14,7 +14,8 @@ function zooAPI(zooAPIConfig) { }) .catch(function (error) { console.log('Failed to refresh token: ', error); - factory.signOut; + alert('Your session has finished. Please save your work and login again.') + authFactory.signOut; }) } // There's only a version of this project on production, so rather than diff --git a/app/modules/zoo-api/zooapi.module.js b/app/modules/zoo-api/zooapi.module.js index d21f7eb..a6ec4f6 100644 --- a/app/modules/zoo-api/zooapi.module.js +++ b/app/modules/zoo-api/zooapi.module.js @@ -1,4 +1,6 @@ 'use strict'; module.exports = require('angular') - .module('app.zooapi', []); + .module('app.zooapi', [ + 'app.auth' + ]);