commit b022be9ba82a1b8425f117ea5fe54da4eb56b60f
parent 8feed2916fee7a06e82e6df5070a9c4ee042bcd0
Author: BlackDex <black.dex@gmail.com>
Date: Sat, 3 Dec 2022 17:28:25 +0100
Fix admin repost warning.
Currently when you login into the admin, and then directly hit the save
button, it will come with a re-post/re-submit warning.
This has to do with the `window.location.reload()` function, which
triggers the admin login POST again.
By changing the way to reload the page, we prevent this repost.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/static/templates/admin/base.hbs b/src/static/templates/admin/base.hbs
@@ -32,7 +32,11 @@
<script>
'use strict';
- function reload() { window.location.reload(); }
+ function reload() {
+ // Reload the page by setting the exact same href
+ // Using window.location.reload() could cause a repost.
+ window.location = window.location.href;
+ }
function msg(text, reload_page = true) {
text && alert(text);
reload_page && reload();