Fix: - app/(application)/(user)/event/[id]/publish.tsx - app/(application)/(user)/voting/(tabs)/_layout.tsx - app/(application)/(user)/voting/(tabs)/status.tsx - app/(application)/(user)/voting/[id]/index.tsx - app/(application)/(user)/voting/create.tsx - app/(application)/admin/voting/[id]/[status]/index.tsx - app/(application)/admin/voting/[id]/[status]/reject-input.tsx - screens/Admin/Event/funUpdateStatus.ts - screens/Admin/Voting/funUpdateStatus.ts - service/api-admin/api-admin-voting.ts - types/type-collect-other.ts ### No Issue
51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
import { typeRejectedData } from "@/types/type-collect-other";
|
|
import { apiConfig } from "../api-config";
|
|
|
|
export async function apiAdminVoting({
|
|
category,
|
|
search,
|
|
}: {
|
|
category: "dashboard" | "history" | "publish" | "review" | "report";
|
|
search?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/voting?category=${category}&search=${search}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminVotingById({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/admin/voting/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminVotingUpdateStatus({
|
|
id,
|
|
data,
|
|
status,
|
|
}: {
|
|
id: string;
|
|
data?: typeRejectedData;
|
|
status: "publish" | "review" | "reject";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(
|
|
`/mobile/admin/voting/${id}?status=${status}`,
|
|
{
|
|
data: data,
|
|
}
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|