change password
This commit is contained in:
@@ -17,13 +17,14 @@ import { ErrorType } from '../../../helpers/types'
|
|||||||
const LoginStep3: FC = () => {
|
const LoginStep3: FC = () => {
|
||||||
|
|
||||||
const { t } = useTranslation('global')
|
const { t } = useTranslation('global')
|
||||||
const { setStepLogin, email } = useAuthStore()
|
const { setStepLogin, email, phone } = useAuthStore()
|
||||||
const loginWithPassword = useLoginWithPassword()
|
const loginWithPassword = useLoginWithPassword()
|
||||||
|
|
||||||
const formik = useFormik<LoginWithPasswordType>({
|
const formik = useFormik<LoginWithPasswordType>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
password: '',
|
password: '',
|
||||||
email: email
|
email: email ? email : undefined,
|
||||||
|
phone: phone ? phone : undefined,
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { XOR } from "../../../helpers/types";
|
|
||||||
|
|
||||||
export type LoginType = {
|
export type LoginType = {
|
||||||
phone_email: string;
|
phone_email: string;
|
||||||
};
|
};
|
||||||
@@ -16,11 +14,10 @@ export type AuthStoreType = {
|
|||||||
setStepLogin: (value: number) => void;
|
setStepLogin: (value: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LoginWithPasswordType = XOR<
|
export type LoginWithPasswordType = {
|
||||||
{ email: string },
|
email?: string;
|
||||||
{ phone: number }
|
|
||||||
> & {
|
|
||||||
password: string;
|
password: string;
|
||||||
|
phone?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LoginWithOtpType = {
|
export type LoginWithOtpType = {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const ChangePassword: FC = () => {
|
|||||||
newPassword: Yup.string()
|
newPassword: Yup.string()
|
||||||
.required(t('errors.required')),
|
.required(t('errors.required')),
|
||||||
repeatPassword: Yup.string()
|
repeatPassword: Yup.string()
|
||||||
.required(t('errors.required'))
|
.required(t('errors.required')),
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
if (values.newPassword !== values.repeatPassword) {
|
if (values.newPassword !== values.repeatPassword) {
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ export const updateSettings = async (params: UpdateSettingType) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const changePassword = async (params: ChangePasswordType) => {
|
export const changePassword = async (params: ChangePasswordType) => {
|
||||||
await axios.post(`/settings/password`, params);
|
await axios.patch(`/auth/password`, params);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user