mirror of
https://github.com/yawaflua/yaflay.ru.git
synced 2026-02-04 19:04:12 +02:00
pooko
This commit is contained in:
@@ -1,4 +1,42 @@
|
||||
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
let blogId = $("#blogId").text();
|
||||
function loadComments () {
|
||||
fetch(`/api/Blog/${blogId}/comments`)
|
||||
.then(response => {
|
||||
let data = response.json();
|
||||
data.then(k => {
|
||||
for (let i = 0; i < k.length; i++) {
|
||||
let date = new Date(k[i].dateTime * 1000);
|
||||
$("#commentBar").after(
|
||||
`<div class="d-flex flex flex-start bg-dark bot-1">
|
||||
<div class="container">
|
||||
<h6 class="fw-bold mb-1">${k[i].creatorMail}</h6>
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<p class="mb-0">
|
||||
${date.toLocaleString() }
|
||||
</p>
|
||||
</div>
|
||||
<p class="mb-0">
|
||||
${k[i].text}
|
||||
</p>
|
||||
</div>
|
||||
</div>`
|
||||
)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$("#postComment").click(
|
||||
function () {
|
||||
var contentBody = {
|
||||
text: $("#commentText").val(),
|
||||
sender: $("#userEmail").val()
|
||||
}
|
||||
$.ajax(`/api/Blog/${blogId}/comments`, {
|
||||
data: JSON.stringify(contentBody),
|
||||
contentType: "application/json",
|
||||
method: "post"
|
||||
}).done(response => { $("#commentText").val(''); $("#userEmail").val(''); $("#commentBar").empty(); loadComments(); })
|
||||
|
||||
// Write your JavaScript code.
|
||||
}
|
||||
);
|
||||
$(loadComments());
|
||||
Reference in New Issue
Block a user