delete user company

This commit is contained in:
Alexandro Uc Santos
2024-01-04 21:02:50 -06:00
parent 923b55b12c
commit 6ebeb0f4a2
5 changed files with 199 additions and 43 deletions

View File

@@ -27,7 +27,39 @@ export const getUsers = async(companyId) => {
try {
const endpoint = `/users?company=${companyId}`;
const {data} = await api.get(endpoint);
console.log(data);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const createUser = async(formData) => {
try {
const endpoint = `/users`;
const {data} = await api.post(endpoint, formData);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const updateUser = async(user_id, formData) => {
try {
const endpoint = `/users/${user_id}`;
const {data} = await api.patch(endpoint, formData);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const deleteUser = async(user_id) => {
try {
const endpoint = `/users/${user_id}`;
const {data} = await api.delete(endpoint);
return data;
} catch (error) {
console.log(error);