clean mundex pages cache within music suggestion review page

This commit is contained in:
Hamid Reza Mohammadi 2021-07-22 09:34:59 +04:30
parent 9094dd7511
commit fde2ec4ccf
3 changed files with 39 additions and 0 deletions

View File

@ -181,5 +181,7 @@ else
<p><a role="button" onclick="rebuildMundex()" class="actionlink" title="بازسازی صفحات نمایهٔ موسیقی">بازسازی صفحات نمایهٔ موسیقی</a></p>
<p><a role="button" onclick="cleanMundexCache()" class="actionlink" title="حذف کش صفحات نمایهٔ موسیقی">حذف کش صفحات نمایهٔ موسیقی</a></p>

View File

@ -166,5 +166,23 @@ namespace GanjooRazor.Areas.User.Pages
}
return new OkObjectResult(false);
}
public async Task<IActionResult> OnPostCleanMundexCacheAsync()
{
using (HttpClient secureClient = new HttpClient())
{
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
HttpResponseMessage response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/ganjoor/page/cache/64899");// =>/mundex
response.EnsureSuccessStatusCode();
response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/ganjoor/page/cache/70833");// =>mundex/bypoet
response.EnsureSuccessStatusCode();
return new OkObjectResult(true);
}
}
return new OkObjectResult(false);
}
}
}

View File

@ -147,6 +147,25 @@
});
}
function cleanMundexCache() {
if (!confirm('آیا از حذف کش صفحات موسیقی اطمینان دارید؟'))
return;
var url = '?handler=CleanMundexCache';
$.ajax({
type: "POST",
url: url,
error: function () {
alert('خطا رخ داد.')
},
success: function () {
alert('کش صفخات پاک شد.')
},
});
}
</script>
</head>