mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
6319455e91
Strict Project Context GitOrigin-RevId: a0f7f2b3dcb29fbd0102dcb920cf5424a921d583
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
import {
|
|
deleteJSON,
|
|
getJSON,
|
|
postJSON,
|
|
putJSON,
|
|
} from '../../../infrastructure/fetch-json'
|
|
import { executeV2Captcha } from './captcha'
|
|
|
|
export function sendInvite(projectId, email, privileges) {
|
|
return executeV2Captcha(
|
|
window.ExposedSettings.recaptchaDisabled?.invite
|
|
).then(grecaptchaResponse => {
|
|
return postJSON(`/project/${projectId}/invite`, {
|
|
body: {
|
|
email, // TODO: normalisedEmail?
|
|
privileges,
|
|
'g-recaptcha-response': grecaptchaResponse,
|
|
},
|
|
})
|
|
})
|
|
}
|
|
|
|
export function resendInvite(projectId, invite) {
|
|
return postJSON(`/project/${projectId}/invite/${invite._id}/resend`)
|
|
}
|
|
|
|
export function revokeInvite(projectId, invite) {
|
|
return deleteJSON(`/project/${projectId}/invite/${invite._id}`)
|
|
}
|
|
|
|
export function updateMember(projectId, member, data) {
|
|
return putJSON(`/project/${projectId}/users/${member._id}`, {
|
|
body: data,
|
|
})
|
|
}
|
|
|
|
export function removeMemberFromProject(projectId, member) {
|
|
return deleteJSON(`/project/${projectId}/users/${member._id}`)
|
|
}
|
|
|
|
export function transferProjectOwnership(projectId, member) {
|
|
return postJSON(`/project/${projectId}/transfer-ownership`, {
|
|
body: {
|
|
user_id: member._id,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function setProjectAccessLevel(projectId, publicAccessLevel) {
|
|
return postJSON(`/project/${projectId}/settings/admin`, {
|
|
body: { publicAccessLevel },
|
|
})
|
|
}
|
|
|
|
export function listProjectMembers(projectId) {
|
|
return getJSON(`/project/${projectId}/members`)
|
|
}
|
|
|
|
export function listProjectInvites(projectId) {
|
|
return getJSON(`/project/${projectId}/invites`)
|
|
}
|