Merge pull request #287 from bipproduction/amalia/04-okt-24

upd: banner
This commit is contained in:
Amalia
2024-10-04 11:00:10 +08:00
committed by GitHub
2 changed files with 28 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
export const funGetAllBanner = async (path?: string) => {
const response = await fetch(`/api/banner${(path) ? path : ''}`, { next: { tags: ['banner'] } });
return await response.json().catch(() => null);
}
export const funDeleteBanner = async (path: string) => {
const response = await fetch(`/api/banner/${path}`, {
method: "DELETE",
@@ -6,4 +11,26 @@ export const funDeleteBanner = async (path: string) => {
},
});
return await response.json().catch(() => null);
};
};
export const funCreateBanner = async (data: FormData) => {
const response = await fetch(`/api/banner`, {
method: "POST",
body: data,
});
return await response.json().catch(() => null);
}
export const funGetOneBanner = async (path: string) => {
const response = await fetch(`/api/banner/${path}`)
return await response.json().catch(() => null);
}
export const funEditBanner = async (path: string, data: FormData) => {
const response = await fetch(`/api/banner/${path}`, {
method: "PUT",
body: data,
});
return await response.json().catch(() => null);
}