2024-10-18 07:21:12: merge [main:5410dbee742841318d58b4865020b1b33dd6c586];

This commit is contained in:
txix committed 2024-10-18 07:21:12 +03:00
1 parent ae26c073e1
commit 3ddbdbda6d
60 files changed
+1595 -747

No files matched your search

+14 -11
View File
@@ -1,24 +1,28 @@
import { message } from 'antd'
import { FormComponents } from 'isp-ui-kit'
import { FC, useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { apiPaths } from '@constants/api/apiPaths.ts'
import Modal from '@widgets/Modal'
import {
ChangePasswordModalProps,
ChangePasswordModalType
} from '@components/ChangePasswordModal/change-password-modal.type.ts'
import { apiService } from '@services/apiService.ts'
import { ChangeProfilePassword } from '@pages/ProfilePage/profile-page.type.ts'
import { apiPaths } from '@constants/api/apiPaths.ts'
import { message } from 'antd'
import useLogout from '@hooks/useLogout.tsx'
import { apiService } from '@services/apiService.ts'
const { FormInputPassword } = FormComponents
const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
open,
onClose
}) => {
open,
onClose
}) => {
const {
control,
handleSubmit,
@@ -36,10 +40,10 @@ const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
const onSubmit = async (formValue: ChangePasswordModalType) => {
setLoading(true)
try {
await apiService.post<ChangeProfilePassword>(
apiPaths.changePassword,
{ oldPassword: formValue.oldPassword, newPassword: formValue.newPassword }
)
await apiService.post<ChangeProfilePassword>(apiPaths.changePassword, {
oldPassword: formValue.oldPassword,
newPassword: formValue.newPassword
})
await logoutUser()
message.success('Пароль успешно изменен')
clearErrors('oldPassword')
@@ -115,4 +119,3 @@ const ChangePasswordModal: FC<ChangePasswordModalProps> = ({
)
}
export default ChangePasswordModal