create account and recipe working. Explore kind of works

This commit is contained in:
durn
2026-04-17 10:46:38 -06:00
parent b32b3d3a03
commit b26af70ef5
8 changed files with 78 additions and 18 deletions
@@ -2,6 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="UTF-8">
<meta name="_csrf_header" th:content="${_csrf.headerName}"/>
<meta name="_csrf" th:content="${_csrf.token}"/>
<title>Create Thyme Crunch Account</title>
<link rel="stylesheet" th:href="@{css/create-account.css}">
<link href="https://fonts.googleapis.com/css2?family=Delius+Swash+Caps&family=Mali:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700" rel="stylesheet">
@@ -85,12 +88,17 @@
hashedpassword: password,
role: "USER"
};
const csrfToken = document.querySelector('meta[name="_csrf"]').getAttribute('content');
const csrfHeader = document.querySelector('meta[name="_csrf_header"]').getAttribute('content');
console.log("JSON to submit:", JSON.stringify(userData, null, 2));
fetch("http://localhost:8080/api/users", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
[csrfHeader]: csrfToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(userData)
});