Merge pull request #287 from bipproduction/amalia/04-okt-24
upd: banner
This commit is contained in:
@@ -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) => {
|
export const funDeleteBanner = async (path: string) => {
|
||||||
const response = await fetch(`/api/banner/${path}`, {
|
const response = await fetch(`/api/banner/${path}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
@@ -7,3 +12,25 @@ export const funDeleteBanner = async (path: string) => {
|
|||||||
});
|
});
|
||||||
return await response.json().catch(() => null);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user