generated from Luis/nextjs-python-web-template
frontend #35
@@ -9,31 +9,31 @@ import {
|
||||
APServiceRepositoryDummyData,
|
||||
APServiceRepositoryTableConfig,
|
||||
} from "@/mock/access_point";
|
||||
import {useEffect, useState} from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function AccessPoint() {
|
||||
const [repositoryData, setRepositoryData] = useState([]);
|
||||
const [repositoryData, setRepositoryData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('http://localhost:2979/api/v1/get_repositories', {
|
||||
method: 'GET',
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then(resp => resp.json().then(jsonData => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setRepositoryData(jsonData);
|
||||
} else {
|
||||
setRepositoryData(APServiceRepositoryDummyData);
|
||||
}
|
||||
}
|
||||
))
|
||||
.then()
|
||||
.catch()
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
fetch("http://localhost:2979/api/v1/get_repositories", {
|
||||
method: "GET",
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then((resp) =>
|
||||
resp.json().then((jsonData) => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setRepositoryData(jsonData);
|
||||
} else {
|
||||
setRepositoryData(APServiceRepositoryDummyData);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.then()
|
||||
.catch();
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className="m-10">
|
||||
<SummaryDetails
|
||||
hasRefreshButton
|
||||
|
||||
@@ -2,77 +2,79 @@
|
||||
|
||||
import SummaryDetails from "@/components/summary_card";
|
||||
import {
|
||||
Client1SummaryDetails,
|
||||
Client1ConsumerData,
|
||||
Client1ConsumerTableConfig,
|
||||
Client1ProducerTableConfig,
|
||||
Client1ProducerData,
|
||||
Client1SummaryDetails,
|
||||
Client1ConsumerData,
|
||||
Client1ConsumerTableConfig,
|
||||
Client1ProducerTableConfig,
|
||||
Client1ProducerData,
|
||||
} from "@/mock/client_1";
|
||||
import CustomTable from "@/components/table";
|
||||
import {useEffect, useState} from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Client1() {
|
||||
const [consumerData, setConsumerData] = useState([]);
|
||||
const [producerData, setProducerData] = useState([]);
|
||||
const [consumerData, setConsumerData] = useState([]);
|
||||
const [producerData, setProducerData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('http://localhost:2979/api/v1/get_consumers', {
|
||||
method: 'GET',
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then(resp => resp.json().then(jsonData => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setConsumerData(jsonData);
|
||||
} else {
|
||||
setConsumerData(Client1ConsumerData);
|
||||
}
|
||||
}
|
||||
))
|
||||
.then()
|
||||
.catch()
|
||||
useEffect(() => {
|
||||
fetch("http://localhost:2979/api/v1/get_consumers", {
|
||||
method: "GET",
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then((resp) =>
|
||||
resp.json().then((jsonData) => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setConsumerData(jsonData);
|
||||
} else {
|
||||
setConsumerData(Client1ConsumerData);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.then()
|
||||
.catch();
|
||||
|
||||
fetch('http://localhost:2979/api/v1/get_producers', {
|
||||
method: 'GET',
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then(resp => resp.json().then(jsonData => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setProducerData(jsonData);
|
||||
} else {
|
||||
setProducerData(Client1ProducerData);
|
||||
}
|
||||
}
|
||||
))
|
||||
.then()
|
||||
.catch()
|
||||
}, []);
|
||||
fetch("http://localhost:2979/api/v1/get_producers", {
|
||||
method: "GET",
|
||||
// credentials: 'include',
|
||||
})
|
||||
.then((resp) =>
|
||||
resp.json().then((jsonData) => {
|
||||
console.log(jsonData);
|
||||
if (jsonData.length > 0) {
|
||||
setProducerData(jsonData);
|
||||
} else {
|
||||
setProducerData(Client1ProducerData);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.then()
|
||||
.catch();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="m-10">
|
||||
<SummaryDetails
|
||||
hasAttachDetach
|
||||
hasRefreshButton
|
||||
entity={{
|
||||
name: "Client 1",
|
||||
details: Client1SummaryDetails,
|
||||
}}
|
||||
/>
|
||||
<div>
|
||||
<h4>Consumer View</h4>
|
||||
<CustomTable
|
||||
data={consumerData}
|
||||
configuration={Client1ConsumerTableConfig}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Producer View</h4>
|
||||
<CustomTable
|
||||
data={producerData}
|
||||
configuration={Client1ProducerTableConfig}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div className="m-10">
|
||||
<SummaryDetails
|
||||
hasAttachDetach
|
||||
hasRefreshButton
|
||||
entity={{
|
||||
name: "Client 1",
|
||||
details: Client1SummaryDetails,
|
||||
}}
|
||||
/>
|
||||
<div>
|
||||
<h4>Consumer View</h4>
|
||||
<CustomTable
|
||||
data={consumerData}
|
||||
configuration={Client1ConsumerTableConfig}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Producer View</h4>
|
||||
<CustomTable
|
||||
data={producerData}
|
||||
configuration={Client1ProducerTableConfig}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user