Integrasi API Donation

Fix:
- (application)/(user)/donation/[id]/(news)/[news]/edit-news
- (application)/(user)/donation/[id]/(news)/[news]/index
- (application)/(user)/donation/[id]/(news)/add-news
- (application)/(user)/donation/[id]/(news)/list-of-news
- (application)/(user)/donation/[id]/(news)/recap-of-news
- (application)/(user)/donation/[id]/infromation-fundrising
- service/api-client/api-donation

### No Issue
This commit is contained in:
2025-10-09 17:00:04 +08:00
parent b293310969
commit 0e7b29bb15
7 changed files with 176 additions and 25 deletions

View File

@@ -213,11 +213,45 @@ export async function apiDonationCreateNews({
}
}
export async function apiDonationGetNewsById({ id , category}: { id: string , category: "get-all" | "get-one"}) {
export async function apiDonationGetNewsById({
id,
category,
}: {
id: string;
category: "get-all" | "get-one";
}) {
try {
const response = await apiConfig.get(`/mobile/donation/${id}/news?category=${category}`);
const response = await apiConfig.get(
`/mobile/donation/${id}/news?category=${category}`
);
return response.data;
} catch (error) {
throw error;
}
}
}
export async function apiDonationUpdateNews({
id,
data,
}: {
id: string;
data: any;
}) {
try {
const response = await apiConfig.put(`/mobile/donation/${id}/news`, {
data: data,
});
return response.data;
} catch (error) {
throw error;
}
}
export async function apiDonationDeleteNews({ id }: { id: string }) {
try {
const response = await apiConfig.delete(`/mobile/donation/${id}/news`);
return response.data;
} catch (error) {
throw error;
}
}