// 添加访问记录
import useUserStore from "@/store/modules/user";
import { addViewRecord } from "@/api/admin/enterprise/demand";

export function addViewHistory(type, itemId, itemName) {
  const enterprise = useUserStore().enterprise;
  if (!enterprise) {
    return;
  }
  const enterpriseId = enterprise.id;
  const enterpriseName = enterprise.name;
  const nickname = enterprise.username;
  const phone = enterprise.phone;
  addViewRecord({
    type: type,
    typeId: itemId,
    typeName: itemName,
    enterpriseId: enterpriseId,
    enterpriseName: enterpriseName,
    nickname: nickname,
    phone: phone,
  });
}
