import apiClient from "@/infrastructure/apiClient";
const baseURL = import.meta.env.VITE_API_BASE_URL;

export default {
  async getById(id) {
    return await apiClient
      .get(`${baseURL}/UrlRecord/GetById?id=${id}`)
      .then((r) => r.data)
      .catch(() => ({}));
  },
  async search(searchModel) {
    const params = JSON.parse(JSON.stringify(searchModel));
    return await apiClient
      .post(`${baseURL}/UrlRecord/Search`, params)
      .then((r) => r.data)
      .catch(() => ({ Items: [], TotalRecord: 0 }));
  },
  async updateInfo(model) {
    return await apiClient
      .put(`${baseURL}/UrlRecord/UpdateInfo`, model)
      .then((r) => r.data)
      .catch(() => ({}));
  },
  async update(model) {
    return await apiClient
      .put(`${baseURL}/UrlRecord/UpdateInfo`, model)
      .then((r) => r.data)
      .catch(() => ({}));
  },
};
