Skip to content

Commit bfcbdb4

Browse files
committed
feat(front): 로그인, 회원가입 페이지 제작
1 parent 8258c6d commit bfcbdb4

File tree

11 files changed

+554
-112
lines changed

11 files changed

+554
-112
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.backend.domain.user.dto;
2+
3+
public class LoginResponse {
4+
}

front/next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const nextConfig = {
99
if (process.env.NEXT_PUBLIC_DEV_PROXY === 'true') {
1010
return [
1111
{
12-
source: "/api/:path*",
12+
source: "/:path*",
1313
destination: `${process.env.NEXT_PUBLIC_BACKEND_URL}/:path*`,
1414
},
1515
];

front/src/app/(auth)/login/page.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@ export default function LoginPage() {
1717
const toast = useToast();
1818
const auth = useAuth();
1919
const router = useRouter();
20-
const [username, setUsername] = useState('');
20+
const [email, setEmail] = useState('');
2121
const [password, setPassword] = useState('');
2222
const [loading, setLoading] = useState(false);
2323

2424
async function submit(e: FormEvent) {
2525
e.preventDefault();
26-
const payload: LoginRequest = { username, password };
26+
const payload: LoginRequest = { email, password };
2727
try {
2828
setLoading(true);
2929
const res = await authApi.login(payload);
30-
if (res.accessToken) {
31-
auth.loginWithToken(res.accessToken);
32-
}
33-
toast.push(res.message ?? '로그인 성공');
34-
router.push('/');
30+
31+
// 로그인 응답에서 사용자 정보 저장
32+
auth.loginWithToken(res.user);
33+
34+
toast.push('로그인 성공');
35+
36+
// 페이지 리로드하여 상태 즉시 반영
37+
window.location.href = '/';
3538
} catch (e: any) {
3639
toast.push(`로그인 실패: ${e.message}`);
3740
} finally {
@@ -54,8 +57,8 @@ export default function LoginPage() {
5457
<CardContent>
5558
<form className="space-y-6" onSubmit={submit}>
5659
<div className="space-y-2">
57-
<Label htmlFor="username">아이디/email</Label>
58-
<Input id="username" value={username} onChange={(e) => setUsername(e.target.value)} required />
60+
<Label htmlFor="email">이메일</Label>
61+
<Input id="email" type="email" value={email} onChange={(e) => setEmail(e.target.value)} required />
5962
</div>
6063
<div className="space-y-2">
6164
<Label htmlFor="password">비밀번호</Label>

0 commit comments

Comments
 (0)