upd: banner
Deskripsi: - tambah banner - hapus banner - edit one banner - hapus coding contoh tombol upload pada login page No Issues
This commit is contained in:
35
lib/api.ts
35
lib/api.ts
@@ -30,16 +30,39 @@ export const apiGetBanner = async ({ user }: { user: string }) => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
export const apiCreateBanner = async (data: FormData) => {
|
||||
const response = await api.post('mobile/banner', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
const response = await api.post('mobile/banner', data,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
}
|
||||
)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiDeleteBanner = async (data: { user: string }, id: string) => {
|
||||
const response = await api.delete(`mobile/banner/${id}`, { data })
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiGetBannerOne = async ({ user, id }: { user: string, id: string }) => {
|
||||
const response = await api.get(`mobile/banner/${id}?user=${user}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiEditBanner = async (data: FormData, id: string) => {
|
||||
const response = await api.put(`mobile/banner/${id}`, data,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
}
|
||||
)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
export const apiGetDataHome = async ({ cat, user }: { cat: 'kegiatan' | 'division' | 'progress' | 'dokumen' | 'event' | 'discussion' | 'header' | 'check-late-project', user: string }) => {
|
||||
const response = await api.get(`mobile/home?user=${user}&cat=${cat}`);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user