bfg-common 1.4.321 → 1.4.322

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.
@@ -13,7 +13,7 @@
13
13
  v-model="form"
14
14
  :hostname="props.hostname"
15
15
  :project="props.project"
16
- @apply="onChangePassword"
16
+ @change-password="onChangePassword"
17
17
  @hide="onHideModal"
18
18
  />
19
19
  </template>
@@ -46,12 +46,6 @@ const form = ref<UI_I_ChangePasswordForm>({
46
46
  const onChangePassword = async (): Promise<void> => {
47
47
  const { current_password, new_password } = form.value
48
48
 
49
-
50
- console.log(33333333);
51
- const asd = true
52
- if(asd) {
53
- return
54
- }
55
49
  onHideModal()
56
50
 
57
51
  const sendData: UI_I_ChangePasswordBodyRequest = {
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <ui-modal
3
- test-id="change-password-modal"
3
+ show
4
4
  width="560px"
5
+ test-id="change-password-modal"
5
6
  :title="localization.common.changePassword"
6
7
  :subtitle="props.subtitle"
7
8
  class="change-password"
@@ -87,10 +87,9 @@
87
87
 
88
88
  <script setup lang="ts">
89
89
  import type { UI_I_Localization } from '~/lib/models/interfaces'
90
- import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
91
90
  import type {
92
- UI_I_ChangePasswordBodyRequest,
93
91
  UI_I_FormChangePassword,
92
+ UI_I_ChangePasswordForm,
94
93
  } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
95
94
  import type { UI_T_Project } from '~/lib/models/types'
96
95
  import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form'
@@ -101,10 +100,12 @@ const props = defineProps<{
101
100
  }>()
102
101
  const emits = defineEmits<{
103
102
  (event: 'hide'): void
103
+ (event: 'change-password'): void
104
104
  }>()
105
+ const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
105
106
 
106
107
  const localization = computed<UI_I_Localization>(() => useLocal())
107
- const { $store, $validation }: any = useNuxtApp()
108
+ const { $validation }: any = useNuxtApp()
108
109
  const validation = $validation.call({})
109
110
 
110
111
  const isValid = ref<boolean>(false)
@@ -141,40 +142,9 @@ const onChangePassword = async (): Promise<void> => {
141
142
  return
142
143
  }
143
144
 
144
- onHideModal()
145
-
146
- const sendData: UI_I_ChangePasswordBodyRequest = {
147
- current_password: password.value,
148
- new_password: newPassword.value,
149
- }
150
-
151
- let url = ''
152
- if (props.project === 'sphere') {
153
- const { id } = useLocalStorage('userData')
154
-
155
- url = `ui/users/${id}/passwd`
156
- } else if (props.project === 'procurator') {
157
- url = '/ui/passwd'
158
- }
159
-
160
- const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
161
- method: 'POST',
162
- body: sendData,
163
- key: Date.now().toString(),
164
- })
165
-
166
- if (error.value?.data && error.value.data.error_code !== 0) {
167
- $store.dispatch('main/A_SHOW_NOTIFICATION', {
168
- status: 'error',
169
- headline: localization.value.common.operationFailed,
170
- messages: [
171
- {
172
- title: 'Error',
173
- descriptions: [error.value.data.error_message],
174
- },
175
- ],
176
- })
177
- }
145
+ modelLocal.value.current_password = password.value
146
+ modelLocal.value.new_password = newPassword.value
147
+ emits('change-password')
178
148
  }
179
149
 
180
150
  const showValidationErrors = (text: string): void => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.321",
4
+ "version": "1.4.322",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",