💩 Forsøker å fikse axios-error
Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no> Co-authored-by: Markus A. R. Johansen <markus.aleksander.rakil.johansen@nav.no>
This commit is contained in:
		
							parent
							
								
									3de17e1272
								
							
						
					
					
						commit
						9587a9dff9
					
				
					 1 changed files with 20 additions and 9 deletions
				
			
		|  | @ -3,6 +3,7 @@ import "@navikt/ds-css"; | |||
| import { ArrowLeftIcon, BugIcon, UploadIcon } from "@navikt/aksel-icons"; | ||||
| import { Button, Heading, TextField, Textarea } from "@navikt/ds-react"; | ||||
| import post from "../api/http"; | ||||
| import axios from "axios"; | ||||
| import { useState } from "react"; | ||||
| import router from "next/router"; | ||||
| import BildeOpplastning from "@/components/BildeOpplastning"; | ||||
|  | @ -13,17 +14,27 @@ export default function Feil() { | |||
|     const [beskrivelse, setBeskrivelse] = useState(""); | ||||
| 
 | ||||
|     const handleSubmit = () => { | ||||
|         const data = { | ||||
|             "tittel": tittel, | ||||
|             "beskrivelse": beskrivelse, | ||||
|             "dato": new Date() | ||||
|         }; | ||||
| 
 | ||||
|         post("/nyFeil", data) | ||||
|          | ||||
|         // TODO: clear data fra felter
 | ||||
|         axios.post("https://helse-sprik.intern.dev.nav.no/nyFeil", | ||||
|             { | ||||
|                 "data": { | ||||
|                     tittel: tittel, | ||||
|                     beskrivelse: beskrivelse, | ||||
|                     dato: new Date() | ||||
|                 } | ||||
|             }, { | ||||
|                 headers: { | ||||
|                     'Content-Type': 'application/json' | ||||
|                 } | ||||
|             }).then((response) => { | ||||
|                 console.log(response) | ||||
|             }).catch((error) => { | ||||
|                 console.log(error); | ||||
|             }) | ||||
|     } | ||||
| 
 | ||||
|         // TODO: clear data fra felter
 | ||||
| 
 | ||||
| 
 | ||||
|     return ( | ||||
|         <main className="flex flex-col h-screen"> | ||||
|             <Header/> | ||||
|  |  | |||
		Reference in a new issue
	
	 Amalie Mansåker
						Amalie Mansåker