mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
aa480a2663
[web] migrate from window attributes to getMeta GitOrigin-RevId: 3dcf1ab6b01155e5e4abeb3e78d0fa9053e055bc
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
import {
|
|
deleteJSON,
|
|
getJSON,
|
|
postJSON,
|
|
putJSON,
|
|
} from '../../../infrastructure/fetch-json'
|
|
import { executeV2Captcha } from './captcha'
|
|
import getMeta from '@/utils/meta'
|
|
|
|
export function sendInvite(projectId, email, privileges) {
|
|
return executeV2Captcha(
|
|
getMeta('ol-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`)
|
|
}
|