🚧 Fetching av feilmeldinger fra DB til frontend i form av Promises
WIP: klarer ikke konvertere Promise<any> til Feilmelding[] Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
This commit is contained in:
parent
eb470e3c9e
commit
02f999c56b
7 changed files with 97 additions and 66 deletions
|
@ -7,21 +7,23 @@ import { useState } from "react";
|
|||
import BildeOpplastning from "../components/BildeOpplastning";
|
||||
import Header from "../components/Header";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { backendURL } from "../const";
|
||||
|
||||
export default function Feil() {
|
||||
const [tittel, setTittel] = useState("");
|
||||
const [beskrivelse, setBeskrivelse] = useState("");
|
||||
|
||||
const url = "https://helse-sprik.intern.dev.nav.no"
|
||||
//const url = "http://localhost:5174"
|
||||
|
||||
const handleSubmit = () => {
|
||||
axios.post(url + "/api/nyfeil",
|
||||
{
|
||||
tittel: tittel,
|
||||
beskrivelse: beskrivelse,
|
||||
dato: new Date().toISOString().replace('Z', '')
|
||||
}, {
|
||||
|
||||
const payload = {
|
||||
tittel: tittel,
|
||||
beskrivelse: beskrivelse,
|
||||
dato: new Date().toISOString().replace('Z', '')
|
||||
}
|
||||
|
||||
console.log(payload);
|
||||
|
||||
axios.post(backendURL + "/api/nyfeil", payload, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
|
Reference in a new issue