overleaf/services/web/public/coffee/ide/share/services/projectInvites.coffee
2016-08-04 16:47:48 +01:00

35 lines
776 B
CoffeeScript

define [
"base"
], (App) ->
App.factory "projectInvites", ["ide", "$http", (ide, $http) ->
return {
sendInvite: (email, privileges) ->
$http.post("/project/#{ide.project_id}/invite", {
email: email
privileges: privileges
_csrf: window.csrfToken
})
revokeInvite: (inviteId) ->
$http({
url: "/project/#{ide.project_id}/invite/#{inviteId}"
method: "DELETE"
headers:
"X-Csrf-Token": window.csrfToken
})
resendInvite: (inviteId, privileges) ->
$http.post("/project/#{ide.project_id}/invite/#{inviteId}/resend", {
_csrf: window.csrfToken
})
getInvites: () ->
$http.get("/project/#{ide.project_id}/invites", {
json: true
headers:
"X-Csrf-Token": window.csrfToken
})
}
]