SignIn type safety; remove unused formatNumericValue;

This commit is contained in:
cracklesparkle
2024-12-19 17:06:46 +09:00
parent 59dddfa02c
commit 65b7e275fe
2 changed files with 9 additions and 42 deletions

View File

@ -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
})
}
}
};