refactored api routes

This commit is contained in:
Daniel
2023-08-20 12:00:42 -04:00
parent b0e92c6253
commit 8dfd1598f3
12 changed files with 13 additions and 13 deletions
+4 -4
View File
@@ -22,14 +22,14 @@ type CollectionStore = {
const useCollectionStore = create<CollectionStore>()((set) => ({
collections: [],
setCollections: async () => {
const response = await fetch("/api/routes/collections");
const response = await fetch("/api/collections");
const data = await response.json();
if (response.ok) set({ collections: data.response });
},
addCollection: async (body) => {
const response = await fetch("/api/routes/collections", {
const response = await fetch("/api/collections", {
body: JSON.stringify(body),
headers: {
"Content-Type": "application/json",
@@ -47,7 +47,7 @@ const useCollectionStore = create<CollectionStore>()((set) => ({
return { ok: response.ok, data: data.response };
},
updateCollection: async (collection) => {
const response = await fetch("/api/routes/collections", {
const response = await fetch("/api/collections", {
body: JSON.stringify(collection),
headers: {
"Content-Type": "application/json",
@@ -67,7 +67,7 @@ const useCollectionStore = create<CollectionStore>()((set) => ({
return { ok: response.ok, data: data.response };
},
removeCollection: async (id) => {
const response = await fetch("/api/routes/collections", {
const response = await fetch("/api/collections", {
body: JSON.stringify({ id }),
headers: {
"Content-Type": "application/json",