Added GET and POST routes.

This commit is contained in:
Daniel
2023-02-09 00:41:33 +03:30
parent e5ed2ec5db
commit 0bf1ec0d2a
12 changed files with 198 additions and 36 deletions
+28
View File
@@ -0,0 +1,28 @@
import { useEffect, useState } from "react";
interface Collections {
id: any;
name: string;
role: string;
}
export default function Collections() {
const [collections, setCollections] = useState<Collections[]>([]);
useEffect(() => {
fetch("/api/routes/collections/getCollections")
.then((res) => res.json())
.then((data) => setCollections(data.response));
}, []);
return (
<div className="flex flex-wrap">
{collections.map((e) => {
return (
<div className="p-5 bg-gray-100 m-2 w-max ">
<p>{e.name}</p>
</div>
);
})}
</div>
);
}