Spaces:
Running
Running
Jatin Mehra
commited on
Commit
·
ba76b7d
1
Parent(s):
58dea7f
Clear saved session on page refresh
Browse files- static/js/app.js +13 -0
static/js/app.js
CHANGED
|
@@ -73,6 +73,19 @@ initializeApp();
|
|
| 73 |
function initializeApp() {
|
| 74 |
updateMobileUI();
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
// Check if we have a session in localStorage
|
| 77 |
const savedSession = localStorage.getItem('pdf_insight_session');
|
| 78 |
if (savedSession) {
|
|
|
|
| 73 |
function initializeApp() {
|
| 74 |
updateMobileUI();
|
| 75 |
|
| 76 |
+
// Check if the page was refreshed
|
| 77 |
+
const pageWasRefreshed = (
|
| 78 |
+
window.performance &&
|
| 79 |
+
window.performance.navigation &&
|
| 80 |
+
window.performance.navigation.type === 1
|
| 81 |
+
) || document.referrer === document.location.href;
|
| 82 |
+
|
| 83 |
+
// If page was refreshed, clear any saved session
|
| 84 |
+
if (pageWasRefreshed) {
|
| 85 |
+
localStorage.removeItem('pdf_insight_session');
|
| 86 |
+
return;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
// Check if we have a session in localStorage
|
| 90 |
const savedSession = localStorage.getItem('pdf_insight_session');
|
| 91 |
if (savedSession) {
|