overleaf/services/web/public/coffee/main/clear-sessions.coffee
Shane Kilkelly 25dd998107 clear-sessions page (+4 squashed commits)
Squashed commits:
[3a56af0] Remove cruft
[c5a1f6c] Finalise alignment
[82f741a] Working sessions page
[d40f069] WIP: display sessions
2016-10-07 16:47:00 +01:00

20 lines
543 B
CoffeeScript

define [
"base"
], (App) ->
App.controller "ClearSessionsController", ["$scope", "$http", ($scope, $http) ->
$scope.state =
otherSessions: window.otherSessions
error: false
success: false
$scope.clearSessions = () ->
console.log ">> clearing all sessions"
$http({method: 'POST', url: "/user/sessions/clear", headers: {'X-CSRF-Token': window.csrfToken}})
.success () ->
$scope.state.otherSessions = []
$scope.state.error = false
$scope.state.success = true
.error () ->
$scope.state.error = true
]