import axios from "axios";

// helper functions for fetching, updating and deleting types

axios.defaults.withCredentials = true;

export async function fetchTypes() {
  return await axios.get("http://localhost:8000/types/").then((res) => {
    return res.data;
  });
}

export async function deleteType(type_id) {
  return await axios.delete("http://localhost:8000/types/" + type_id);
}

export async function postType(type) {
  return await axios.post("http://localhost:8000/types/", type);
}
