generated from Luis/nextjs-python-web-template
frontend #35
@@ -1,11 +1,29 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { NoDataOverlay } from "@/components/noDataOverlay";
|
import {NoDataOverlay} from "@/components/noDataOverlay";
|
||||||
import SummaryDetails from "@/components/summary_card";
|
import SummaryDetails from "@/components/summary_card";
|
||||||
import CustomTable from "@/components/table";
|
import CustomTable from "@/components/table";
|
||||||
import { HomeDummyData, HomeTableConfig } from "@/mock/home";
|
import {HomeDummyData, HomeTableConfig} from "@/mock/home";
|
||||||
|
import {useEffect, useState} from "react";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
const [homeData, setHomeData] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch("http://localhost:2979/api/v1/get_entities", {
|
||||||
|
method: "GET",
|
||||||
|
// credentials: 'include',
|
||||||
|
})
|
||||||
|
.then((resp) =>
|
||||||
|
resp.json().then((jsonData) => {
|
||||||
|
console.log(jsonData);
|
||||||
|
jsonData.length > 0 ? setHomeData(jsonData) : setHomeData(HomeDummyData);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.then()
|
||||||
|
.catch();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="m-10">
|
<div className="m-10">
|
||||||
<SummaryDetails
|
<SummaryDetails
|
||||||
@@ -16,7 +34,7 @@ export default function Home() {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h4>Home View Table</h4>
|
<h4>Home View Table</h4>
|
||||||
<CustomTable data={HomeDummyData} configuration={HomeTableConfig} />
|
<CustomTable data={homeData} configuration={HomeTableConfig} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -21,27 +21,27 @@ export const HomeDummyData = [
|
|||||||
|
|
||||||
export const HomeTableConfig = [
|
export const HomeTableConfig = [
|
||||||
{
|
{
|
||||||
key: "entity_name",
|
key: "name",
|
||||||
label: "Entity name",
|
label: "Entity name",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "entity_DID",
|
key: "did",
|
||||||
label: "Entity DID",
|
label: "Entity DID",
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// key: "network",
|
||||||
|
// label: "Network",
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
key: "network",
|
key: "ip",
|
||||||
label: "Network",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "ip_address",
|
|
||||||
label: "IP address",
|
label: "IP address",
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// key: "roles",
|
||||||
|
// label: "Roles",
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
key: "roles",
|
key: "attached",
|
||||||
label: "Roles",
|
label: "Attached",
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "visible",
|
|
||||||
label: "Visible",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user