UNPKG

gaf-mobile

Version:

GAF mobile Web site

24 lines (21 loc) 684 B
'use strict'; angular.module('gafMobileApp') .controller('LogoutCtrl', function($location, Auth, Analytics) { if (Auth.isAuthenticated()) { Auth.logout() .then(function() { Analytics.trackAction('user', 'logout', 'SUCCESS'); // If we have a return URI, go back there if ($location.search().return) { $location.url(decodeURI($location.search().return)); } else { // Overwise go home $location.url('/'); } }).catch(function(error) { Analytics.trackError('user', 'logout', error.code, error.data); }); } else { $location.url('/'); } });