EN-94: fix: Migrate to api v1

This commit is contained in:
Josepablo Cruz Baas
2024-03-12 03:25:39 +00:00
parent 5e6de53098
commit 33e5c8caa4
11 changed files with 90 additions and 31 deletions

View File

@@ -56,6 +56,17 @@ export const updateUser = async(user_id, formData) => {
}
}
export const updateMyUserProfile = async(formData) => {
try {
const endpoint = `/v1/users/profile`;
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 = `/v1/users/member/${user_id}`;
@@ -115,7 +126,7 @@ export const deleteBudget = async(id) => {
export const getLocations = async(filter) => {
try {
const endpoint = `/branches/${filter}&$limit=3&$sort%5BcreatedAt%5D=-1`;
const endpoint = `/v1/branches/find${filter}&$limit=3&$sort%5BcreatedAt%5D=-1`;
console.log(endpoint);
const {data} = await api.get(endpoint);
return data;
@@ -127,7 +138,7 @@ export const getLocations = async(filter) => {
export const createLocation = async(formData) => {
try {
const endpoint = `/branches`;
const endpoint = `/v1/branches/new`;
const {data} = await api.post(endpoint, formData);
return data;
} catch (error) {
@@ -138,7 +149,7 @@ export const createLocation = async(formData) => {
export const updateLocation = async(id, formData) => {
try {
const endpoint = `/branches/${id}`;
const endpoint = `/v1/branches/${id}`;
const {data} = await api.patch(endpoint, formData);
return data;
} catch (error) {
@@ -149,7 +160,7 @@ export const updateLocation = async(id, formData) => {
export const deleteLocation = async(id) => {
try {
const endpoint = `/branches/${id}`;
const endpoint = `/v1/branches/${id}`;
const {data} = await api.delete(endpoint);
return data;
} catch (error) {