ritz26 commited on
Commit
b0ceca0
·
1 Parent(s): d721dd6

update the backend to fully clear session and uploaded files on Change Person.

Browse files
Files changed (1) hide show
  1. templates/index.html +7 -17
templates/index.html CHANGED
@@ -155,7 +155,7 @@
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,23 +196,13 @@
196
  }
197
  });
198
 
199
- // Change Person function
200
  function changePerson() {
201
- fetch('/change_person', {
202
- method: 'POST',
203
- headers: {
204
- 'Content-Type': 'application/x-www-form-urlencoded',
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)