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
- <!-- <common-layout-the-header-modals-redirect-login />-->
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
- // import { checkIsTokenExpired } from '~/lib/utils/token'
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
- // const expireTime =
132
- // props.expireTimeFromState || useCookie('token-expired-time')
133
- //
134
- // const isExpiredToken = checkIsTokenExpired(expireTime)
135
- //
136
- //
137
- // isExpiredToken && emits('show-redirect-login-modal', true)
138
- //
139
- // if (!isExpiredToken) {
140
- emits('show-reconnect-modal', true)
141
- startInactivityTimer()
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)
@@ -26,7 +26,7 @@
26
26
  class="btn btn-primary"
27
27
  @click="onRedirectLoginPage"
28
28
  >
29
- {{ localization.common.login }}
29
+ {{ localization.auth.login }}
30
30
  </button>
31
31
  </template>
32
32
  </atoms-modal>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.642",
4
+ "version": "1.4.643",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",