Files
mobile-darmasaba/lib/api/calendar.api.ts
amaliadwiy d299484a98 refactor: pecah lib/api.ts dan constants/Styles.ts per domain
- lib/api.ts (879 baris) → 13 file di lib/api/ per domain
- constants/Styles.ts (1.275 baris) → 10 file di constants/styles/ per domain
- tambah docs/FILE-HEALTH.md dan referensinya ke CLAUDE.md
- kedua file lama tetap sebagai re-export — zero breaking changes
2026-05-12 10:34:31 +08:00

57 lines
2.8 KiB
TypeScript

import api from './client';
export const apiGetCalendarByDateDivision = async ({ user, date, division }: { user: string, date: string, division: string }) => {
const response = await api.get(`mobile/calendar?user=${user}&date=${date}&division=${division}`);
return response.data;
};
export const apiGetIndicatorCalendar = async ({ user, date, division }: { user: string, date: string, division: string }) => {
const response = await api.get(`mobile/calendar/indicator?user=${user}&date=${date}&division=${division}`);
return response.data;
};
export const apiGetCalendarOne = async ({ user, id, cat }: { user: string, id: string, cat: 'data' | 'member' }) => {
const response = await api.get(`mobile/calendar/${id}?user=${user}&cat=${cat}`);
return response.data;
};
export const apiGetCalendarHistory = async ({ user, search, division, page }: { user: string, search: string, division: string, page?: number }) => {
const response = await api.get(`mobile/calendar/history?user=${user}&search=${search}&division=${division}&page=${page}`);
return response.data;
};
export const apiCreateCalendar = async ({ data }: { data: { idDivision: string, title: string, desc: string, timeStart: string, timeEnd: string, dateStart: string, repeatEventTyper: string, repeatValue: string, linkMeet: string, member: any[], user: string } }) => {
const response = await api.post(`/mobile/calendar`, data)
return response.data;
};
export const apiUpdateCalendar = async ({ data, id }: { data: { title: string, desc: string, timeStart: string, timeEnd: string, dateStart: string, repeatEventTyper: string, repeatValue: number, linkMeet: string, user: string }, id: string }) => {
const response = await api.put(`/mobile/calendar/${id}`, data)
return response.data;
};
export const apiDeleteCalendar = async (data: { user: string }, id: string) => {
const response = await api.delete(`/mobile/calendar/${id}`, { data })
return response.data
};
export const apiAddMemberCalendar = async ({ data, id }: { data: { user: string, member: any[] }, id: string }) => {
const response = await api.post(`/mobile/calendar/${id}/member`, data)
return response.data;
};
export const apiDeleteCalendarMember = async (data: { user: string, idUser: string }, id: string) => {
const response = await api.delete(`/mobile/calendar/${id}/member`, { data })
return response.data
};
export const apiGetVillageCalendarByDate = async ({ user, date }: { user: string, date: string }) => {
const response = await api.get(`mobile/village-calendar?user=${user}&date=${date}`);
return response.data;
};
export const apiGetVillageCalendarIndicator = async ({ user, date }: { user: string, date: string }) => {
const response = await api.get(`mobile/village-calendar/indicator?user=${user}&date=${date}`);
return response.data;
};