Improve EditUser card link auto refresh

This commit is contained in:
Laura Hausmann 2023-05-20 01:00:31 +02:00
parent dfbece632c
commit be957242f6
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -26,21 +26,35 @@
@section Scripts {
<script src="/js/idle-timer.min.js"></script>
<script>
$(() => {
$.idleTimer(30000);
});
$(document).on("idle.idleTimer", () => {
window.location.replace('/');
});
</script>
}
@if (linkActive) {
@section Header {
<meta http-equiv="refresh" content="5"/>
}}
@if (linkActive) {
<script>
$(() => {
setInterval(() => {
fetch(document.location).then(res => {
res.text().then(text => {
let dummyDOM = $('<div></div>');
dummyDOM.html(text);
let newTableContents = $('#cards>', dummyDOM);
$('#cards').html(newTableContents);
})
});
}, 1000);
});
</script>
}
else {
<script>
$(() => {
$.idleTimer(30000);
});
$(document).on("idle.idleTimer", () => {
window.location.replace('/');
});
</script>
}
}
<div class="text-center">
<h1 class="display-5">
@ -252,7 +266,7 @@
}
}
<div class="row justify-content-center">
<div class="row justify-content-center" id="cards">
@{
foreach (var card in cards) {
await RenderCard(user.Nickname, card.Id, cardType: card.Type);