🏗️ 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:
		
							parent
							
								
									7b58056c43
								
							
						
					
					
						commit
						70d813758d
					
				
					 1 changed files with 10 additions and 12 deletions
				
			
		|  | @ -1,22 +1,19 @@ | ||||||
| import "@navikt/ds-css"; | import "@navikt/ds-css"; | ||||||
| 
 |  | ||||||
| import { Button, Heading } from "@navikt/ds-react"; | import { Button, Heading } from "@navikt/ds-react"; | ||||||
| 
 | import axios , { AxiosError } from "axios"; | ||||||
| const axios=require('axios').default | import { log } from "console"; | ||||||
| 
 | import { useState } from "react"; //useSWR hilsen Emil ;D
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| async function getWorld() { | async function getWorld() { | ||||||
|   axios.get("/") |   try { | ||||||
|   .then((response : any) => { |     const {data} : {data: any} = await axios.get("http://0.0.0.0:8080/"); | ||||||
|     console.log(response); |     console.log(data); | ||||||
|   }).catch((error : any) => { |     return data | ||||||
|  |   } catch (error) { | ||||||
|     console.log(error); |     console.log(error); | ||||||
|   }) |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| export default function Home() { | export default function Home() { | ||||||
|   getWorld(); |   getWorld(); | ||||||
|   return ( |   return ( | ||||||
|  | @ -25,6 +22,7 @@ export default function Home() { | ||||||
|         <Heading level="1" size="xlarge">Sprik</Heading> |         <Heading level="1" size="xlarge">Sprik</Heading> | ||||||
|         <Button variant="primary">Meld inn feil</Button> |         <Button variant="primary">Meld inn feil</Button> | ||||||
|         <Button variant="secondary">Meld inn funksjonalitetsønsker</Button> |         <Button variant="secondary">Meld inn funksjonalitetsønsker</Button> | ||||||
|  |         {/* <p>{getWorld()}</p> */} | ||||||
|       </div> |       </div> | ||||||
|     </main> |     </main> | ||||||
|   ) |   ) | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Markus Johansen
						Markus Johansen