Skip to content

Commit 20fdf0d

Browse files
authored
fix(fe): apply feedback (#226)
* refactor: simplify login request and update login hook callback * feat: update host status in session participants modal on user response
1 parent 31a5981 commit 20fdf0d

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

apps/client/src/components/modal/SessionParticipantsModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function SessionParticipantsModal() {
2525
sessionToken,
2626
setSessionUsers,
2727
updateSessionUser,
28+
updateReplyIsHost,
2829
} = useSessionStore();
2930

3031
const [selectedUserId, setSelectedUserId] = useState<number>();
@@ -48,6 +49,7 @@ function SessionParticipantsModal() {
4849
isHost: params.isHost,
4950
}),
5051
onSuccess: (res) => {
52+
updateReplyIsHost(res.user.userId, res.user.isHost);
5153
updateSessionUser(res.user);
5254
addToast({
5355
type: 'SUCCESS',

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)