Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 93x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x | // Pro API - Team Management Operations
import { request } from "../base";
import type { TeamMember, TeamInvitation, ContactCheckResult } from "./types";
export const teamApi = {
async getMembers(proId: string, includeInactive = false) {
const query = includeInactive ? "?includeInactive=true" : "";
return request<TeamMember[]>(`/api/pro/${proId}/team${query}`);
},
async addMember(
proId: string,
data: { email: string; role: "owner" | "manager" | "staff" },
) {
return request<TeamMember>(`/api/pro/${proId}/team`, {
method: "POST",
body: data,
});
},
async updateMember(
proId: string,
roleId: number,
data: { role: "manager" | "staff" },
) {
return request<TeamMember>(`/api/pro/${proId}/team/${roleId}`, {
method: "PUT",
body: data,
});
},
async removeMember(proId: string, roleId: number) {
return request(`/api/pro/${proId}/team/${roleId}`, {
method: "DELETE",
});
},
async deactivateMember(proId: string, roleId: number) {
return request<TeamMember>(
`/api/pro/${proId}/team/${roleId}/deactivate`,
{ method: "POST" },
);
},
async reactivateMember(proId: string, roleId: number) {
return request<TeamMember>(
`/api/pro/${proId}/team/${roleId}/reactivate`,
{ method: "POST" },
);
},
// Contact check (debounced pre-validation)
async checkContact(
proId: string,
data: { email?: string; phone?: string },
) {
return request<ContactCheckResult>(`/api/pro/${proId}/team/check-contact`, {
method: "POST",
body: data,
});
},
// Invitations
async invite(
proId: string,
data: { email?: string; phone?: string; role: "owner" | "manager" | "staff" },
) {
return request<TeamInvitation>(`/api/pro/${proId}/team/invite`, {
method: "POST",
body: data,
});
},
async getInvitations(proId: string) {
return request<TeamInvitation[]>(
`/api/pro/${proId}/team/invitations`,
);
},
async resendInvitation(proId: string, invitationId: number) {
return request(
`/api/pro/${proId}/team/invitations/${invitationId}/resend`,
{ method: "POST" },
);
},
async cancelInvitation(proId: string, invitationId: number) {
return request(`/api/pro/${proId}/team/invitations/${invitationId}`, {
method: "DELETE",
});
},
};
|