This repository has been archived on 2024-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
helseveileder/frontend/src/api/postBugData.ts
haraldnilsen 145c8a5b1d 👽 updated backend endpoint
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
2024-01-13 13:12:11 +01:00

20 lines
431 B
TypeScript

export const postBugData = async (bugText: string) => {
let url = "https://helseundersokelsen.no/submitbug";
const response = fetch(url, {
method: "POST",
body: JSON.stringify({
bugText: bugText,
}),
})
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.ok;
})
.catch((error) => {
console.log(error);
});
return response;
};