💩 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 { ArrowLeftIcon, BugIcon, UploadIcon } from "@navikt/aksel-icons";
|
||||||
import { Button, Heading, TextField, Textarea } from "@navikt/ds-react";
|
import { Button, Heading, TextField, Textarea } from "@navikt/ds-react";
|
||||||
import post from "../api/http";
|
import post from "../api/http";
|
||||||
|
import axios from "axios";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import router from "next/router";
|
import router from "next/router";
|
||||||
import BildeOpplastning from "@/components/BildeOpplastning";
|
import BildeOpplastning from "@/components/BildeOpplastning";
|
||||||
|
@ -13,16 +14,26 @@ export default function Feil() {
|
||||||
const [beskrivelse, setBeskrivelse] = useState("");
|
const [beskrivelse, setBeskrivelse] = useState("");
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const data = {
|
axios.post("https://helse-sprik.intern.dev.nav.no/nyFeil",
|
||||||
"tittel": tittel,
|
{
|
||||||
"beskrivelse": beskrivelse,
|
"data": {
|
||||||
"dato": new Date()
|
tittel: tittel,
|
||||||
};
|
beskrivelse: beskrivelse,
|
||||||
|
dato: new Date()
|
||||||
post("/nyFeil", data)
|
}
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
}).then((response) => {
|
||||||
|
console.log(response)
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: clear data fra felter
|
// TODO: clear data fra felter
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex flex-col h-screen">
|
<main className="flex flex-col h-screen">
|
||||||
|
|
Reference in a new issue