|
|
|
|
@ -5,12 +5,15 @@ import find from 'lodash/find' |
|
|
|
|
import map from 'lodash/map' |
|
|
|
|
|
|
|
|
|
import { formIds } from 'config/form' |
|
|
|
|
import { AUTH_SERVICE } from 'config/routes' |
|
|
|
|
|
|
|
|
|
import { useForm } from 'features/FormStore' |
|
|
|
|
import { useLexicsStore } from 'features/LexicsStore' |
|
|
|
|
|
|
|
|
|
import { SaveUserInfo } from 'requests' |
|
|
|
|
|
|
|
|
|
import { readToken } from 'helpers/token' |
|
|
|
|
|
|
|
|
|
import { useUserInfoForm } from './useUserInfoForm' |
|
|
|
|
import { useValidateForm } from './useValidateForm' |
|
|
|
|
|
|
|
|
|
@ -32,6 +35,7 @@ export const useUserInfo = ({ loader, onSubmit }: Props) => { |
|
|
|
|
readFormValue, |
|
|
|
|
updateFormValue, |
|
|
|
|
} = useForm() |
|
|
|
|
const token = readToken() |
|
|
|
|
const validateForm = useValidateForm() |
|
|
|
|
const { onPhoneBlur } = useUserInfoForm() |
|
|
|
|
const readTrimmedValue = useCallback( |
|
|
|
|
@ -101,6 +105,10 @@ export const useUserInfo = ({ loader, onSubmit }: Props) => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const resetPassword = useCallback(() => { |
|
|
|
|
window.location.href = `${AUTH_SERVICE}/change_password?token=${token}` |
|
|
|
|
}, [token]) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
handleSubmit, |
|
|
|
|
hasChanges, |
|
|
|
|
@ -111,6 +119,7 @@ export const useUserInfo = ({ loader, onSubmit }: Props) => { |
|
|
|
|
onPhoneBlur, |
|
|
|
|
readFormError, |
|
|
|
|
readFormValue, |
|
|
|
|
resetPassword, |
|
|
|
|
updateFormValue, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|