@beterdichtbij/component-library 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
|
|
5
|
+
export const useSessionTimeOutStore = defineStore('SessionTimeOutStore', () => {
|
|
6
|
+
const threshold = ref(null)
|
|
7
|
+
const warningThreshold = ref(null);
|
|
8
|
+
const time: any = ref(dayjs());
|
|
9
|
+
const taskId = ref(null);
|
|
10
|
+
|
|
11
|
+
const SetDefaultSessionTimeOutValues = (ServerDefaultValues : any) => {
|
|
12
|
+
threshold.value = ServerDefaultValues.TimeOutSessionInMinutes;
|
|
13
|
+
warningThreshold.value = ServerDefaultValues.TimeOutSessionShowWarning;
|
|
14
|
+
SetNewTime();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SetNewTime = () => {
|
|
18
|
+
time.value = dayjs();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SetTaskId = (id : any) => {
|
|
22
|
+
taskId.value = id;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ClearSessionTimeOut = () => {
|
|
26
|
+
if (taskId.value) {
|
|
27
|
+
clearInterval(taskId.value);
|
|
28
|
+
}
|
|
29
|
+
threshold.value = null
|
|
30
|
+
warningThreshold.value = null;
|
|
31
|
+
time.value = null;
|
|
32
|
+
taskId.value = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const GetTime = () => time.value;
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
SetDefaultSessionTimeOutValues,
|
|
39
|
+
SetTaskId,
|
|
40
|
+
ClearSessionTimeOut,
|
|
41
|
+
threshold,
|
|
42
|
+
warningThreshold,
|
|
43
|
+
taskId,
|
|
44
|
+
GetTime,
|
|
45
|
+
SetNewTime
|
|
46
|
+
}
|
|
47
|
+
})
|