Add connection to backend test

This commit is contained in:
glax 2024-10-18 02:20:22 +02:00
parent cf09bc50fb
commit ca091bac92
2 changed files with 20 additions and 8 deletions

View File

@ -1,17 +1,28 @@
import React from 'react';
import React, {ReactElement, useEffect} from 'react';
import Footer from "./modules/Footer";
import Search from "./modules/Search";
import Header from "./modules/Header";
export default function App(){
// @ts-ignore
const content = <div>
<Header />
<Search />
<Footer />
</div>
const [content, setContent] = React.useState<ReactElement>();
return(content)
useEffect(() => {
setContent(<h1>Testing connection to backend...</h1>)
getData('http://127.0.0.1:6531/v2/Ping').then((result) => {
console.log(result);
if(result === null){
setContent(<h1>No connection to backend</h1>);
}else{
setContent(<Search />)
}
})
}, []);
return(<div>
<Header />
{content}
<Footer />
</div>)
}
export function getData (uri: string) : Promise<object> {

View File

@ -20,6 +20,7 @@ body{
background-color: var(--background-color);
font-family: "Inter", sans-serif;
overflow-x: hidden;
color: var(--primary-color);
}
header {