upd: redesign
Deskripsi: - login dan konfirmasi kode otp - firebase code env No Issues
This commit is contained in:
61
lib/api.ts
61
lib/api.ts
@@ -96,30 +96,18 @@ export const apiGetGroup = async ({ user, active, search }: { user: string, acti
|
||||
};
|
||||
|
||||
export const apiCreateGroup = async (data: { user: string, name: string }) => {
|
||||
await api.post('mobile/group', data).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.post('mobile/group', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiEditGroup = async (data: { user: string, name: string }, id: string) => {
|
||||
await api.put(`mobile/group/${id}`, data).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.put(`mobile/group/${id}`, data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiDeleteGroup = async (data: { user: string, isActive: boolean }, id: string) => {
|
||||
await api.delete(`mobile/group/${id}`, { data }).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.delete(`mobile/group/${id}`, { data });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiGetPosition = async ({ user, active, search, group }: { user: string, active: string, search: string, group?: string }) => {
|
||||
@@ -128,22 +116,14 @@ export const apiGetPosition = async ({ user, active, search, group }: { user: st
|
||||
};
|
||||
|
||||
export const apiCreatePosition = async (data: { user: string, name: string, idGroup: string }) => {
|
||||
await api.post('mobile/position', data).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.post('mobile/position', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
export const apiDeletePosition = async (data: { user: string, isActive: boolean }, id: string) => {
|
||||
await api.delete(`mobile/position/${id}`, { data }).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.delete(`mobile/position/${id}`, { data });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiEditPosition = async (data: { user: string, name: string, idGroup: string }, id: string) => {
|
||||
@@ -207,12 +187,8 @@ export const apiUpdateDiscussionGeneralCommentar = async ({ id, data }: { id: st
|
||||
|
||||
|
||||
export const apiDeleteMemberDiscussionGeneral = async (data: { user: string, idUser: string }, id: string) => {
|
||||
await api.delete(`mobile/discussion-general/${id}/member`, { data }).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.delete(`mobile/discussion-general/${id}/member`, { data });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
@@ -222,19 +198,10 @@ export const apiUpdateStatusDiscussionGeneral = async ({ id, data }: { id: strin
|
||||
};
|
||||
|
||||
export const apiDeleteDiscussionGeneral = async (data: { user: string, active: boolean }, id: string) => {
|
||||
await api.delete(`mobile/discussion-general/${id}`, { data }).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
const response = await api.delete(`mobile/discussion-general/${id}`, { data });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// export const apiEditDiscussionGeneral = async (data: { user: string, title: string, desc: string }, id: string) => {
|
||||
// const response = await api.put(`/mobile/discussion-general/${id}`, data)
|
||||
// return response.data;
|
||||
// };
|
||||
|
||||
export const apiEditDiscussionGeneral = async (data: FormData, id: string) => {
|
||||
const response = await api.put(`/mobile/discussion-general/${id}`, data, {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user