This commit is contained in:
Дмитрий Шиманский
2023-12-19 17:24:04 +03:00
parent f8ff067789
commit 36d4b07e0e
5 changed files with 39 additions and 17 deletions

View File

@@ -11,18 +11,20 @@ function updateAnnotation(value) {
function sendArticleData () {
let melon = document.cookie.split(';')[0].replace("melon=", "");
let body = `{
title: ${$("#titleInput").val()},
annotation: ${$("#annotationArea").val()},
text: ${$("#textArea").val()},
image: ${$("#imgInput").val()},
author: ${melon}
}`
fetch("/api/Blog", {
method: "POST",
headers: {
Authorization: `Bearer ${melon}`
Authorization: `Bearer ${melon}`,
"Content-Type": "application/json"
},
body: {
title: $("#titleInput").val(),
annotation: $("#annotationArea").val(),
text: $("#textArea").val(),
image: $("#imgInput").val(),
author: melon
}
body: body
}).then(k => console.log(k));
$("#titleInput").val('');
$("#annotationArea").val('');

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB