clear-sessions.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* eslint-disable
  2. max-len,
  3. no-return-assign,
  4. no-undef,
  5. */
  6. // TODO: This file was created by bulk-decaffeinate.
  7. // Fix any style issues and re-enable lint.
  8. /*
  9. * decaffeinate suggestions:
  10. * DS102: Remove unnecessary code created because of implicit returns
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. define(['base'], App =>
  14. App.controller('ClearSessionsController', function($scope, $http) {
  15. $scope.state = {
  16. otherSessions: window.otherSessions,
  17. error: false,
  18. success: false
  19. }
  20. return ($scope.clearSessions = function() {
  21. console.log('>> clearing all sessions')
  22. return $http({
  23. method: 'POST',
  24. url: '/user/sessions/clear',
  25. headers: { 'X-CSRF-Token': window.csrfToken }
  26. })
  27. .then(function() {
  28. $scope.state.otherSessions = []
  29. $scope.state.error = false
  30. return ($scope.state.success = true)
  31. })
  32. .catch(() => ($scope.state.error = true))
  33. })
  34. }))