Event – User - app/(application)/(user)/event/(tabs)/contribution.tsx - app/(application)/(user)/event/(tabs)/index.tsx - app/(application)/(user)/event/[id]/list-of-participants.tsx Voting – User - app/(application)/(user)/voting/(tabs)/history.tsx Components - components/Notification/NotificationInitializer.tsx - components/_ShareComponent/NewWrapper.tsx Screens – Event - screens/Event/BoxPublishSection.tsx - screens/Event/ButtonStatusSection.tsx - screens/Event/ScreenHistory.tsx - screens/Event/ScreenStatus.tsx Screens – Forum - screens/Forum/ViewBeranda3.tsx API Client - service/api-client/api-event.ts Styles - styles/global-styles.ts Docs - docs/prompt-for-qwen-code.md Untracked (New Files) - screens/Event/ScreenBeranda.tsx - screens/Event/ScreenContribution.tsx - screens/Event/ScreenListOfParticipants.tsx #### No Issue
194 lines
3.7 KiB
TypeScript
194 lines
3.7 KiB
TypeScript
import { apiConfig } from "../api-config";
|
|
|
|
export async function apiEventCreate(data: any) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/event`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventGetByStatus({
|
|
id,
|
|
status,
|
|
page = "1",
|
|
}: {
|
|
id: string;
|
|
status: string;
|
|
page?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/event/${id}/${status}?page=${page}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventGetOne({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/event/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventUpdateStatus({
|
|
id,
|
|
status,
|
|
}: {
|
|
id: string;
|
|
status: "draft" | "review" | "publish" | "reject";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(`/mobile/event/${id}/${status}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventUpdateData({
|
|
id,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
data: any;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(`/mobile/event/${id}`, {
|
|
data: data,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventDelete({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.delete(`/mobile/event/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventGetAll({
|
|
category,
|
|
userId,
|
|
page = "1",
|
|
}: {
|
|
category?: "beranda" | "contribution" | "all-history" | "my-history";
|
|
userId?: string;
|
|
page?: string;
|
|
}) {
|
|
try {
|
|
const categoryEvent = category ? `?category=${category}` : "";
|
|
const userIdCreator = userId ? `&userId=${userId}` : "";
|
|
const pageParam = `&page=${page}`;
|
|
const response = await apiConfig.get(
|
|
`/mobile/event${categoryEvent}${userIdCreator}${pageParam}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventJoin({
|
|
id,
|
|
userId,
|
|
}: {
|
|
id: string;
|
|
userId?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.post(`/mobile/event/${id}/participants`, {
|
|
userId: userId,
|
|
});
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventListOfParticipants({
|
|
id,
|
|
page = "1"
|
|
}: {
|
|
id?: string;
|
|
page?: string;
|
|
}) {
|
|
try {
|
|
const pageParam = page ? `?page=${page}` : "";
|
|
const response = await apiConfig.get(`/mobile/event/${id}/participants${pageParam}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventCheckParticipants({
|
|
id,
|
|
userId,
|
|
}: {
|
|
id: string;
|
|
userId?: string;
|
|
}) {
|
|
try {
|
|
const selectUserId = userId ? `?userId=${userId}` : "";
|
|
const response = await apiConfig.get(
|
|
`/mobile/event/${id}/check-participants${selectUserId}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventGetConfirmation({
|
|
id,
|
|
userId,
|
|
}: {
|
|
id: string;
|
|
userId?: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/event/${id}/confirmation?userId=${userId}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiEventConfirmationAction({
|
|
id,
|
|
userId,
|
|
category,
|
|
}: {
|
|
id: string;
|
|
userId?: string;
|
|
category?: "join_and_confirm" | "confirmation";
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.post(
|
|
`/mobile/event/${id}/confirmation?category=${category}`,
|
|
{
|
|
data: {
|
|
userId: userId,
|
|
},
|
|
}
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
|