diff --git a/DrSousan.Api/wwwroot/admin/index.html b/DrSousan.Api/wwwroot/admin/index.html index 1984cc6..521ba72 100644 --- a/DrSousan.Api/wwwroot/admin/index.html +++ b/DrSousan.Api/wwwroot/admin/index.html @@ -2103,8 +2103,10 @@ async function savePost(){ categoryId:catId?parseInt(catId):null, ogImage:document.getElementById('post-image').value, }; - if(id) await api(`/api/blog/posts/${id}`,{method:'PUT',body:JSON.stringify(body)}); - else await api('/api/blog/posts',{method:'POST',body:JSON.stringify(body)}); + const res = id + ? await api(`/api/blog/posts/${id}`,{method:'PUT',body:JSON.stringify(body)}) + : await api('/api/blog/posts',{method:'POST',body:JSON.stringify(body)}); + if(res === null && id) return; // api() already showed error toast closeModal('postModal'); toast('مقاله ذخیره شد ✓'); loadPosts(); }