change password
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user