Fix: app/(application)/admin/forum/[id]/index.tsx app/(application)/admin/forum/[id]/list-comment.tsx app/(application)/admin/forum/[id]/list-report-comment.tsx app/(application)/admin/forum/[id]/list-report-posting.tsx app/(application)/admin/forum/index.tsx app/(application)/admin/forum/posting.tsx app/(application)/admin/forum/report-comment.tsx app/(application)/admin/forum/report-posting.tsx screens/Admin/listPageAdmin.tsx service/api-admin/api-admin-forum.ts ### No Issue
92 lines
1.9 KiB
TypeScript
92 lines
1.9 KiB
TypeScript
import { apiConfig } from "../api-config";
|
|
|
|
export async function apiAdminForum({
|
|
category,
|
|
search,
|
|
}: {
|
|
category: "dashboard" | "posting" | "report_posting" | "report_comment";
|
|
search?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/forum?category=${category}&search=${search}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminForumPostingById({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/admin/forum/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
export async function apiAdminForumCommentById({
|
|
id,
|
|
category,
|
|
}: {
|
|
id: string;
|
|
category: "get-all" | "get-one";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/forum/${id}/comment?category=${category}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminForumListReportCommentById({
|
|
id,
|
|
}: {
|
|
id: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/forum/${id}/report-comment`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminForumDeactivateComment({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.put(`/mobile/admin/forum/${id}/comment`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminForumListReportPostingById({
|
|
id,
|
|
}: {
|
|
id: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/forum/${id}/report-posting`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminForumDeactivatePosting({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.put(`/mobile/admin/forum/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|