Skip to content

Commit a4ce8c7

Browse files
committed
refactor: simplify login request and update login hook callback
1 parent 31a5981 commit a4ce8c7

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

apps/client/src/features/auth/auth.api.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import axios from 'axios';
22

33
import {
44
PostLoginRequestDTO,
5-
PostLoginRequestSchema,
65
PostLoginResponseDTO,
7-
PostLoginResponseSchema,
86
PostRefreshResponseDTO,
97
PostRefreshResponseSchema,
108
} from '@/features/auth/auth.dto';
@@ -13,11 +11,8 @@ const AUTH_BASE_URL = '/api/auth';
1311

1412
export const login = (body: PostLoginRequestDTO) =>
1513
axios
16-
.post<PostLoginResponseDTO>(
17-
`${AUTH_BASE_URL}/login`,
18-
PostLoginRequestSchema.parse(body),
19-
)
20-
.then((res) => PostLoginResponseSchema.parse(res.data));
14+
.post<PostLoginResponseDTO>(`${AUTH_BASE_URL}/login`, body)
15+
.then((res) => res.data);
2116

2217
export const logout = () => axios.post(`${AUTH_BASE_URL}/logout`);
2318

apps/client/src/features/auth/auth.hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function useSignInForm() {
5858
const isLoginEnabled = email.length > 0 && password.length > 7 && !isPending;
5959

6060
const handleLogin = (callback: () => void) =>
61-
loginQuery({ email, password }, { onSettled: callback });
61+
loginQuery({ email, password }, { onSuccess: callback });
6262

6363
return {
6464
email,

0 commit comments

Comments
 (0)