-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated faulty method signiture, added automatic reloading on session…
… timeout, added popup to indicate a session timeout
- Loading branch information
Felix Ruf
committed
Jul 10, 2024
1 parent
a7ac846
commit a5aab74
Showing
4 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div> | ||
<PopupModal | ||
:isOpen="isOpen" | ||
> | ||
<div | ||
class="max-w-[300px] p-4" | ||
> | ||
<p | ||
class="max-w-[300px] text-center align-middle font-bold" | ||
> | ||
__Session_abgelaufen_text_Platzhalter__ | ||
</p> | ||
<CreateButton | ||
btnText="Reload" | ||
:managed=true | ||
@click="isOpen = false" | ||
/> | ||
</div> | ||
</PopupModal> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import PopupModal from '@/components/misc/PopupModal.vue'; | ||
import CreateButton from '@/components/misc/CreateButton.vue'; | ||
import { onMounted, ref } from 'vue'; | ||
const TEN_MINUTES_MILLIS = 600000 | ||
const isOpen = ref(false); | ||
const timestamp = ref<number>(0); | ||
onMounted(() => { | ||
console.log('Mounted FocusAlert') | ||
timestamp.value = Date.now(); | ||
window.addEventListener('focus', async () => { | ||
console.log('received focus!'); | ||
if (Date.now() - timestamp.value > TEN_MINUTES_MILLIS) { | ||
try { | ||
timestamp.value = Date.now(); | ||
await fetch(window.location.href); | ||
} catch (error) { | ||
isOpen.value = true; | ||
} | ||
} | ||
}); | ||
}); | ||
</script> |