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