import api from './client';

export const apiGetBanner = async ({ user }: { user: string }) => {
   const response = await api.get(`mobile/banner?user=${user}`);
   return response.data;
};

export const apiCreateBanner = async (data: FormData) => {
   const response = await api.post('mobile/banner', data, {
      headers: { 'Content-Type': 'multipart/form-data' },
   })
   return response.data;
};

export const apiDeleteBanner = async (data: { user: string }, id: string) => {
   const response = await api.delete(`mobile/banner/${id}`, { data })
   return response.data;
};

export const apiGetBannerOne = async ({ user, id }: { user: string, id: string }) => {
   const response = await api.get(`mobile/banner/${id}?user=${user}`);
   return response.data;
};

export const apiEditBanner = async (data: FormData, id: string) => {
   const response = await api.put(`mobile/banner/${id}`, data, {
      headers: { 'Content-Type': 'multipart/form-data' },
   })
   return response.data;
};
