add: crud locations
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user