2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
no-return-assign,
|
|
|
|
no-undef,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-04-06 07:45:56 -04:00
|
|
|
define(['../base'], App =>
|
2019-07-16 05:13:18 -04:00
|
|
|
App.controller('ClearSessionsController', function($scope, $http) {
|
|
|
|
$scope.state = {
|
|
|
|
otherSessions: window.otherSessions,
|
|
|
|
error: false,
|
|
|
|
success: false
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2019-07-16 05:13:18 -04:00
|
|
|
return ($scope.clearSessions = function() {
|
|
|
|
console.log('>> clearing all sessions')
|
|
|
|
return $http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/user/sessions/clear',
|
|
|
|
headers: { 'X-CSRF-Token': window.csrfToken }
|
2018-11-05 05:06:39 -05:00
|
|
|
})
|
2019-07-16 05:13:18 -04:00
|
|
|
.then(function() {
|
|
|
|
$scope.state.otherSessions = []
|
|
|
|
$scope.state.error = false
|
|
|
|
return ($scope.state.success = true)
|
|
|
|
})
|
|
|
|
.catch(() => ($scope.state.error = true))
|
|
|
|
})
|
|
|
|
}))
|