bfg-common 1.4.642 → 1.4.643
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.
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
/>
|
|
67
67
|
|
|
68
68
|
<common-layout-the-header-modals-reconnect />
|
|
69
|
-
|
|
69
|
+
<common-layout-the-header-modals-redirect-login />
|
|
70
70
|
</template>
|
|
71
71
|
|
|
72
72
|
<script setup lang="ts">
|
|
73
73
|
import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
|
|
74
74
|
import type { UI_T_Project } from '~/lib/models/types'
|
|
75
75
|
import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
|
|
76
|
-
|
|
76
|
+
import { checkIsTokenExpired } from '~/lib/utils/token'
|
|
77
77
|
|
|
78
78
|
const props = defineProps<{
|
|
79
79
|
isShowMainMenu: boolean
|
|
@@ -96,6 +96,8 @@ const props = defineProps<{
|
|
|
96
96
|
isDarkTheme: boolean
|
|
97
97
|
isPauseReconnect: boolean
|
|
98
98
|
expireTimeFromState: number
|
|
99
|
+
isShowReconnectModal: boolean
|
|
100
|
+
isShowRedirectLoginModal: boolean
|
|
99
101
|
}>()
|
|
100
102
|
|
|
101
103
|
const emits = defineEmits<{
|
|
@@ -123,23 +125,29 @@ const startInactivityTimer = (): void => {
|
|
|
123
125
|
inactivityTimer.value = setTimeout(() => {
|
|
124
126
|
// Проверяем если isPauseReconnect истина то не показываем модальное окно переподключения,
|
|
125
127
|
// к примеру если загружаем файл и он загружается дольше чем срабатывает таймаут
|
|
128
|
+
|
|
126
129
|
if (props.isPauseReconnect) {
|
|
127
130
|
startInactivityTimer()
|
|
128
131
|
return
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
const expireTime =
|
|
135
|
+
props.expireTimeFromState || useCookie('token-expired-time').value
|
|
136
|
+
|
|
137
|
+
const isExpiredToken = checkIsTokenExpired(expireTime)
|
|
138
|
+
|
|
139
|
+
if (isExpiredToken) {
|
|
140
|
+
emits('show-redirect-login-modal', true)
|
|
141
|
+
|
|
142
|
+
if (props.isShowReconnectModal) {
|
|
143
|
+
emits('show-reconnect-modal', false)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!isExpiredToken && !props.isShowRedirectLoginModal) {
|
|
148
|
+
emits('show-reconnect-modal', true)
|
|
149
|
+
startInactivityTimer()
|
|
150
|
+
}
|
|
143
151
|
|
|
144
152
|
console.log('Пользователь бездействует!')
|
|
145
153
|
}, inactivityTimeout.value)
|