mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
39c8595c27
To not cause confusion with team invites. They are not really an invite because they are user initiated, but more of a user choosing to join a team.
35 lines
1 KiB
CoffeeScript
35 lines
1 KiB
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.controller "DomainSubscriptionJoinController", ($scope, $http) ->
|
|
|
|
$scope.inflight = false
|
|
|
|
if has_personal_subscription
|
|
$scope.view = "personalSubscription"
|
|
else
|
|
$scope.view = "domainSubscriptionJoin"
|
|
|
|
$scope.keepPersonalSubscription = ->
|
|
$scope.view = "domainSubscriptionJoin"
|
|
|
|
$scope.cancelSubscription = ->
|
|
$scope.inflight = true
|
|
request = $http.post "/user/subscription/cancel", {_csrf:window.csrfToken}
|
|
request.then ()->
|
|
$scope.inflight = false
|
|
$scope.view = "domainSubscriptionJoin"
|
|
request.catch ()->
|
|
console.log "the request failed"
|
|
|
|
$scope.joinGroup = ->
|
|
$scope.view = "requestSent"
|
|
$scope.inflight = true
|
|
request = $http.post "/user/subscription/#{group_subscription_id}/group/join", {_csrf:window.csrfToken}
|
|
request.then (response)->
|
|
{ status } = response
|
|
$scope.inflight = false
|
|
if status != 200 # assume request worked
|
|
$scope.requestSent = false
|
|
request.catch ()->
|
|
console.log "the request failed"
|