diff --git a/src/pages/auth/components/LoginStep3.tsx b/src/pages/auth/components/LoginStep3.tsx index 7d82016..d938437 100644 --- a/src/pages/auth/components/LoginStep3.tsx +++ b/src/pages/auth/components/LoginStep3.tsx @@ -17,13 +17,14 @@ import { ErrorType } from '../../../helpers/types' const LoginStep3: FC = () => { const { t } = useTranslation('global') - const { setStepLogin, email } = useAuthStore() + const { setStepLogin, email, phone } = useAuthStore() const loginWithPassword = useLoginWithPassword() const formik = useFormik({ initialValues: { password: '', - email: email + email: email ? email : undefined, + phone: phone ? phone : undefined, }, validationSchema: Yup.object({ password: Yup.string() diff --git a/src/pages/auth/types/AuthTypes.ts b/src/pages/auth/types/AuthTypes.ts index dc263bc..5d86165 100644 --- a/src/pages/auth/types/AuthTypes.ts +++ b/src/pages/auth/types/AuthTypes.ts @@ -1,5 +1,3 @@ -import { XOR } from "../../../helpers/types"; - export type LoginType = { phone_email: string; }; @@ -16,11 +14,10 @@ export type AuthStoreType = { setStepLogin: (value: number) => void; }; -export type LoginWithPasswordType = XOR< - { email: string }, - { phone: number } -> & { +export type LoginWithPasswordType = { + email?: string; password: string; + phone?: string; }; export type LoginWithOtpType = { diff --git a/src/pages/setting/components/ChangePassword.tsx b/src/pages/setting/components/ChangePassword.tsx index d4c0e95..b8e8dd0 100644 --- a/src/pages/setting/components/ChangePassword.tsx +++ b/src/pages/setting/components/ChangePassword.tsx @@ -26,7 +26,7 @@ const ChangePassword: FC = () => { newPassword: Yup.string() .required(t('errors.required')), repeatPassword: Yup.string() - .required(t('errors.required')) + .required(t('errors.required')), }), onSubmit: (values) => { if (values.newPassword !== values.repeatPassword) { diff --git a/src/pages/setting/service/SettingService.ts b/src/pages/setting/service/SettingService.ts index 61f8d97..61ab9f7 100644 --- a/src/pages/setting/service/SettingService.ts +++ b/src/pages/setting/service/SettingService.ts @@ -11,5 +11,5 @@ export const updateSettings = async (params: UpdateSettingType) => { }; export const changePassword = async (params: ChangePasswordType) => { - await axios.post(`/settings/password`, params); + await axios.patch(`/auth/password`, params); };