import api from './client';

export const apiGetDataHome = async ({ cat, user }: { cat: 'kegiatan' | 'division' | 'progress' | 'dokumen' | 'event' | 'discussion' | 'header' | 'check-late-project', user: string }) => {
   const response = await api.get(`mobile/home?user=${user}&cat=${cat}`);
   return response.data;
};

export const apiGetSearch = async ({ text, user }: { text: string, user: string }) => {
   const response = await api.get(`mobile/home/search?search=${text}&user=${user}`);
   return response.data;
};

export const apiGetNotification = async ({ user, page }: { user: string, page?: number }) => {
   const response = await api.get(`mobile/home/notification?user=${user}&page=${page}`);
   return response.data;
};

export const apiReadOneNotification = async (data: { user: string, id: string }) => {
   const response = await api.put(`/mobile/home/notification`, data)
   return response.data;
};

export const apiReadAllNotification = async (data: { user: string }) => {
   const response = await api.post(`/mobile/home/notification`, data)
   return response.data;
};
