Spaces:
Runtime error
Runtime error
update the backend to fully clear session and uploaded files on Change Person.
Browse files- templates/index.html +7 -17
templates/index.html
CHANGED
|
@@ -155,7 +155,7 @@
|
|
| 155 |
|
| 156 |
</div>
|
| 157 |
|
| 158 |
-
|
| 159 |
<div id="global-loader" style="display:none;" class="fixed inset-0 z-50 bg-black/70 flex items-center justify-center">
|
| 160 |
<div class="flex flex-col items-center">
|
| 161 |
<svg class="animate-spin h-16 w-16 text-pink-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
@@ -196,23 +196,13 @@
|
|
| 196 |
}
|
| 197 |
});
|
| 198 |
|
| 199 |
-
// Change Person
|
| 200 |
function changePerson() {
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
})
|
| 207 |
-
.then(response => response.text())
|
| 208 |
-
.then(html => {
|
| 209 |
-
// Replace the current page content
|
| 210 |
-
document.documentElement.innerHTML = html;
|
| 211 |
-
})
|
| 212 |
-
.catch(error => {
|
| 213 |
-
console.error('Error changing person:', error);
|
| 214 |
-
alert('Error changing person. Please refresh the page.');
|
| 215 |
-
});
|
| 216 |
}
|
| 217 |
|
| 218 |
// Show file name + preview (person only)
|
|
|
|
| 155 |
|
| 156 |
</div>
|
| 157 |
|
| 158 |
+
<!-- Global Full-screen Loader Overlay -->
|
| 159 |
<div id="global-loader" style="display:none;" class="fixed inset-0 z-50 bg-black/70 flex items-center justify-center">
|
| 160 |
<div class="flex flex-col items-center">
|
| 161 |
<svg class="animate-spin h-16 w-16 text-pink-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
|
|
| 196 |
}
|
| 197 |
});
|
| 198 |
|
| 199 |
+
// Change Person: full refresh via POST + server redirect
|
| 200 |
function changePerson() {
|
| 201 |
+
const form = document.createElement('form');
|
| 202 |
+
form.method = 'POST';
|
| 203 |
+
form.action = '/change_person';
|
| 204 |
+
document.body.appendChild(form);
|
| 205 |
+
form.submit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
}
|
| 207 |
|
| 208 |
// Show file name + preview (person only)
|