add: crud locations

This commit is contained in:
Alexandro Uc Santos
2024-01-09 18:49:51 -06:00
parent 6ebeb0f4a2
commit 937c3a8fe5
8 changed files with 678 additions and 2 deletions

View File

@@ -113,6 +113,50 @@ export const deleteBudget = async(id) => {
}
}
export const getLocations = async(filter) => {
try {
const endpoint = `/branches/${filter}`;
const {data} = await api.get(endpoint);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const createLocation = async(formData) => {
try {
const endpoint = `/branches`;
const {data} = await api.post(endpoint, formData);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const updateLocation = async(id, formData) => {
try {
const endpoint = `/branches/${id}`;
const {data} = await api.patch(endpoint, formData);
return data;
} catch (error) {
console.log(error);
return null;
}
}
export const deleteLocation = async(id) => {
try {
const endpoint = `/branches/${id}`;
const {data} = await api.delete(endpoint);
return data;
} catch (error) {
console.log(error);
return null;
}
}
// export const editCompany = async(companyId, formData) => {
// try {