The source project of this merge request has been removed.
fix: hide deleted draft immediately
issue: draft cannot hide immediately when confirm deleted draft
if post as draft, and click delete button and confirmed, that draft still alive till refresh page
I thought that issue from src\Moonglade.Web\Pages\Admin\Draft.cshtml
line 27,
function deletePost(postid) {
$(`#span-processing-${postid}`).show();
callApi(`/api/post/${postid}/recycle`, 'DELETE', {},
(resp) => {
$(`#tr-${postid}`).hide(); // this line
});
}
actually we cannot found element by $(
#tr-${postid})
, e.g. $(
#tr-3e0e4bba-d7d3-47ae-872f-9a135fc3003d})
,
but we can found it by '$(#post-${postid}
)', e.g. $(
#post-3e0e4bba-d7d3-47ae-872f-9a135fc3003d})
, this element written at line 42:
@foreach (var post in posts.OrderByDescending(p => p.LastModifiedUtc))
{
<div id="post-@post.Id"> // line 42
that is why I change $(
#tr-${postid}).hide();
to $(
#post-${postid}).hide();
at line 27
Edited by dvorak chen