2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
no-return-assign,
|
|
|
|
*/
|
|
|
|
// 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-05-19 05:02:56 -04:00
|
|
|
import App from '../base'
|
2021-03-26 05:52:52 -04:00
|
|
|
import getMeta from '../utils/meta'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2023-10-13 05:13:49 -04:00
|
|
|
export default App.controller('ClearSessionsController', [
|
|
|
|
'$scope',
|
|
|
|
'$http',
|
2021-04-14 09:17:21 -04:00
|
|
|
function ($scope, $http) {
|
|
|
|
$scope.state = {
|
|
|
|
otherSessions: getMeta('ol-otherSessions'),
|
|
|
|
error: false,
|
2021-04-27 03:52:58 -04:00
|
|
|
success: false,
|
2021-04-14 09:17:21 -04:00
|
|
|
}
|
2020-05-19 05:02:56 -04:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
return ($scope.clearSessions = function () {
|
|
|
|
return $http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/user/sessions/clear',
|
2021-04-27 03:52:58 -04:00
|
|
|
headers: { 'X-CSRF-Token': window.csrfToken },
|
2020-05-19 05:02:56 -04:00
|
|
|
})
|
2021-04-14 09:17:21 -04:00
|
|
|
.then(function () {
|
|
|
|
$scope.state.otherSessions = []
|
|
|
|
$scope.state.error = false
|
|
|
|
return ($scope.state.success = true)
|
|
|
|
})
|
|
|
|
.catch(() => ($scope.state.error = true))
|
|
|
|
})
|
2023-10-13 05:13:49 -04:00
|
|
|
},
|
|
|
|
])
|