import axios from "axios";
import baseUrl from "../utils/baseUrl.js";

const addsubject = async (info, userId) => {
  console.log('subject check', userId)
  // info.user = userId;
  const url = `${baseUrl}/api/subject/addsubject`;
  const { data } = await axios.post(url, { info, userId });
  return data
}

const editSubject = async (info, id) => {
  console.log("editSubject check", info, ',', id)
  const url = `${baseUrl}/api/subject/editsubject`
  const { data } = await axios.post(url, { info, id })
  return data
}

const getSubInfo = async (info) => {
  console.log('info', info)
  const url = `${baseUrl}/api/subject/${info}`
  const { data } = await axios.get(url);
  return data
}

const subjectApi = {
  addsubject,
  getSubInfo,
  editSubject
};

export default subjectApi