DataScope26/WEB
0
1import axiosClient from "./axiosClient.js";2 3export const getCompanyInvites = async (token, companyId) => {4 const response = await axiosClient.get("/invites", {5 params: { companyId },6 headers: { Authorization: token }7 });8 return response.data;9};10 11export const createInvite = async (token, companyId, targetUserMail, areaId) => {12 try {13 const response = await axiosClient.put(14 "/invite",15 {16 companyId,17 targetUserMail,18 areaId19 },20 {21 headers: { Authorization: token }22 }23 );24 return response.data;25 } catch (error) {26 throw error;27 }28};29 30export const deleteInvite = async (token, companyId, inviteToken) => {31 const response = await axiosClient.delete(`/invite/${inviteToken}`, {32 params: { companyId }, // Añadimos el companyId a la query string33 headers: { Authorization: token }34 });35 return response.data;36};37 38export const respondToInvite = async (inviteToken, status) => {39 const response = await axiosClient.patch(`/invite/${inviteToken}/status`, { status });40 return response.data;41};