test new login

This commit is contained in:
hamid zarghami
2025-03-15 11:23:53 +03:30
parent 18a96eac86
commit 488ae501dd
9 changed files with 96 additions and 28 deletions
+4 -2
View File
@@ -13,6 +13,8 @@ import ArrowLeftIcon from '../../../assets/images/arrow-left.svg'
import { useLoginWithPassword } from '../hooks/useAuthData'
import { toast } from 'react-toastify'
import { ErrorType } from '../../../helpers/types'
import { setRefreshToken } from '../../../config/func'
import { setToken } from '../../../config/func'
const LoginStep3: FC = () => {
@@ -33,8 +35,8 @@ const LoginStep3: FC = () => {
onSubmit(values) {
loginWithPassword.mutate(values, {
onSuccess(data) {
localStorage.setItem(import.meta.env.VITE_TOKEN_NAME, data?.data?.accessToken?.token)
localStorage.setItem(import.meta.env.VITE_REFRESH_TOKEN_NAME, data?.data?.refreshToken?.token)
setToken(data?.data?.accessToken?.token)
setRefreshToken(data?.data?.refreshToken?.token)
window.location.href = Pages.dashboard
},
onError(error: ErrorType) {