🏗️ Satt opp axios til gjøre kall mot ktor applikasjon

Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
Co-authored-by: Amalie Mansåker <amalie.erdal.mansaker@nav.no>
This commit is contained in:
Markus Johansen 2023-07-04 12:05:38 +02:00
parent 7b58056c43
commit 70d813758d

View file

@ -1,21 +1,18 @@
import "@navikt/ds-css";
import { Button, Heading } from "@navikt/ds-react";
const axios=require('axios').default
import axios , { AxiosError } from "axios";
import { log } from "console";
import { useState } from "react"; //useSWR hilsen Emil ;D
async function getWorld() {
axios.get("/")
.then((response : any) => {
console.log(response);
}).catch((error : any) => {
try {
const {data} : {data: any} = await axios.get("http://0.0.0.0:8080/");
console.log(data);
return data
} catch (error) {
console.log(error);
})
}
}
export default function Home() {
getWorld();
@ -25,6 +22,7 @@ export default function Home() {
<Heading level="1" size="xlarge">Sprik</Heading>
<Button variant="primary">Meld inn feil</Button>
<Button variant="secondary">Meld inn funksjonalitetsønsker</Button>
{/* <p>{getWorld()}</p> */}
</div>
</main>
)