Skip to content

Commit

Permalink
feat: API 명세 변경사항 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
lurgi committed Aug 20, 2024
1 parent 846fef2 commit d657264
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api/domain/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const apiClient = new APIClient(AUTH);

const authApi = {
login: async ({ email, password }: { email: string; password: string }) =>
apiClient.post({
apiClient.post<{ clubId: string }>({
path: '/login',
body: { email, password },
}),
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/hooks/useSignIn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ export default function useSignIn() {
const navigate = useNavigate();
const signInMutate = useMutation({
mutationFn: ({ email, password }: { email: string; password: string }) => authApi.login({ email, password }),
onSuccess: () => {
// 로그인 성공 후 수행할 작업이 있다면 여기에 작성
// queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.USER_DATA] });
navigate('dashboard/1/posts');
onSuccess: ({ clubId }) => {
navigate(`dashboard/${clubId}/posts`);
},
onError: (error) => {
window.alert(error.message);
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/mocks/handlers/authHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AUTH } from '@api/endPoint';
import { http } from 'msw';
import { Success } from './response';

interface LoginFormData {
email: string;
Expand All @@ -18,7 +17,17 @@ const authHandlers = [
});
}

return Success();
const responseBody = JSON.stringify({
clubId: 1,
});

return new Response(responseBody, {
status: 201,
statusText: 'Created',
headers: {
'Content-Type': 'application/json',
},
});
}),
];

Expand Down

0 comments on commit d657264

Please sign in to comment.