upd: lembaga desa
Deskripsi: - list data lembaga desa - tambah data lembaga desa - edit data lembaga desa - pencarian data lembaga desa - delete data lembaga desa No Issues
This commit is contained in:
33
lib/api.ts
33
lib/api.ts
@@ -49,6 +49,39 @@ export const apiGetDataHome = async ({ cat, user }: { cat: 'kegiatan' | 'divisio
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiGetGroup = async ({ user, active, search }: { user: string, active: string, search: string }) => {
|
||||
const response = await api.get(`mobile/group?user=${user}&active=${active}&search=${search}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// export const updateEntityById = async (id: any, updatedEntity: any) => {
|
||||
// const response = await api.put(`/entities/${id}`, updatedEntity);
|
||||
// return response.data;
|
||||
|
||||
Reference in New Issue
Block a user