SignIn type safety; remove unused formatNumericValue;
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { useForm, SubmitHandler } from 'react-hook-form';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { ApiResponse, LoginFormData } from '../../interfaces/auth';
|
||||
import { login, setUserData } from '../../store/auth';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
@ -39,10 +39,14 @@ const SignIn = () => {
|
||||
login(token)
|
||||
|
||||
navigate('/');
|
||||
} catch (error: any) {
|
||||
setError('password', {
|
||||
message: error?.response?.data?.detail
|
||||
})
|
||||
} catch (error: unknown) {
|
||||
if ((error as AxiosError).response?.data) {
|
||||
const err = (error as AxiosError).response?.data
|
||||
setError('password', {
|
||||
message: (err as { detail: string })?.detail
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user