import request from "@/helpers/request";

/** 详情 */
export const api_userMusicDetail = (params) => {
  return request({
    url: `/userMusic/detail/${params}`,
    method: "get",
    hideLoading: true,
  });
};

/** 开放详情 */
export const api_openUserMusicDetail = (params) => {
  // return request.get(`/open/userMusic/detail/${params}`);
  return request({
    url: `/open/userMusic/detail/${params}`,
    baseURL: "/api-student",
    method: "get",
    hideLoading: true,
    hint: true
  });
};

/**  点赞分页 */
export const api_userMusicStarPage = (params) => {
  return request({
    url: `/userMusicStar/page`,
    method: "post",
    data: params,
    hideLoading: true
  });
};

/**  分享推荐作品 */
export const api_openUserMusicPage = (params) => {
  // return request.post(`/open/userMusic/page`, {
  //   ...params,
  // });
  return request({
    url: `/open/userMusic/page`,
    baseURL: "/api-student",
    method: "post",
    data: params,
    hideLoading: true
  });
};

/** 点赞 */
export const api_userMusicStar = (params) => {
  // return request.post("/userMusicStar/star", {
  //   ...params,
  // });
  return request({
    url: "/userMusicStar/star",
    baseURL: "/api-student",
    hideLoading: true,
    method: "post",
    data: params,
  });
};

/** 保存草稿/发布作品 */
export const api_userMusicSave = (params) => {
  // return request.post("/userMusic/save", {
  //   data: params,
  // });
  return request({
    method: "post",
    url: "/userMusic/save",
    data: params,
  });
};

/** 删除 */
export const api_userMusicRemove = (params) => {
  // return request.post("/userMusic/remove", {
  //   requestType: "form",
  //   params,
  // });
  return request({
    method: "post",
    baseURL: "/api-student",
    url: "/userMusic/remove",
    requestType: "form",
    data: params,
  });
};

/** 授权验证 */
export const api_verification = () => {
  return request.get("/api-auth/checkToken", {
    baseURL: "/api-auth",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
    },
  });
};
