From 0271b96cbff904a2a7a5eda46ca523fccc4a901a Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Wed, 26 Jul 2023 13:03:30 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Fikser=20ingress-"feil"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen Co-authored-by: Amalie Erdal Mansåker --- .gitignore | 5 +---- frontend/src/components/CardsContainer.tsx | 3 +-- frontend/src/const.ts | 6 ------ frontend/src/index.tsx | 3 +-- frontend/src/pages/feil.tsx | 3 +-- 5 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 frontend/src/const.ts diff --git a/.gitignore b/.gitignore index 967b0e1..49877ee 100644 --- a/.gitignore +++ b/.gitignore @@ -71,7 +71,4 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts -### Next ### - -#constants for backend and frontend -./frontend/src/const.ts \ No newline at end of file +### Next ### \ No newline at end of file diff --git a/frontend/src/components/CardsContainer.tsx b/frontend/src/components/CardsContainer.tsx index 4ee8292..a0bc9bb 100644 --- a/frontend/src/components/CardsContainer.tsx +++ b/frontend/src/components/CardsContainer.tsx @@ -1,5 +1,4 @@ import FeilCard from "./FeilCard"; -import { backendURL } from "../const.ts"; import { Feilmelding } from "../interface.ts"; import { useEffect, useState } from "react"; @@ -17,7 +16,7 @@ const CardsContainer = () => { * @returns response */ async function fetchAlleFeil() { - const response = await fetch(backendURL + "/api/hentallefeil", { + const response = await fetch("/api/hentallefeil", { method: "GET", headers: { "Content-Type": "application/json", diff --git a/frontend/src/const.ts b/frontend/src/const.ts deleted file mode 100644 index a6688d6..0000000 --- a/frontend/src/const.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Konstanter vi bruker i diverse filer i applikasjonen - */ - -//export const backendURL = "http://localhost:8080" -export const backendURL = "https://helse-sprik.intern.dev.nav.no" \ No newline at end of file diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 57a2efe..21acd46 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -6,7 +6,6 @@ import { PlusIcon } from "@navikt/aksel-icons"; import Filtermeny from "./components/Filtermeny"; import { useNavigate } from "react-router-dom"; import axios from "axios"; -import { backendURL } from "./const"; export default function Home() { const navigate = useNavigate() @@ -14,7 +13,7 @@ export default function Home() { const handleChange = (soeketekst: string) => { console.log("search changed") - axios.post(backendURL + "/api/hentsok", soeketekst, { + axios.post("/api/hentsok", soeketekst, { headers: { 'Content-Type': 'application/json' } diff --git a/frontend/src/pages/feil.tsx b/frontend/src/pages/feil.tsx index 2ecc399..ee889c1 100644 --- a/frontend/src/pages/feil.tsx +++ b/frontend/src/pages/feil.tsx @@ -7,7 +7,6 @@ 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(""); @@ -22,7 +21,7 @@ export default function Feil() { dato: new Date().toISOString().replace('Z', '') } - axios.post(backendURL + "/api/nyfeil", payload, { + axios.post("/api/nyfeil", payload, { headers: { 'Content-Type': 'application/json' }