change password

This commit is contained in:
hamid zarghami
2025-02-03 15:38:04 +03:30
parent 1db7653cb2
commit f4263283dc
4 changed files with 8 additions and 10 deletions
+3 -2
View File
@@ -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<LoginWithPasswordType>({
initialValues: {
password: '',
email: email
email: email ? email : undefined,
phone: phone ? phone : undefined,
},
validationSchema: Yup.object({
password: Yup.string()
+3 -6
View File
@@ -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 = {
@@ -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) {
+1 -1
View File
@@ -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);
};