feat: แก้ frontend logi npages
This commit is contained in:
@@ -13,7 +13,7 @@ export default function LoginPage() {
|
||||
setErr("");
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/auth/login`, {
|
||||
const res = await fetch(`${API_BASE}/auth/login`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username, password }),
|
||||
@@ -45,15 +45,25 @@ export default function LoginPage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="grid min-h-screen place-items-center" style={{background: 'linear-gradient(to bottom right, #00c6ff, #0072ff)'}}>
|
||||
<form onSubmit={onSubmit} className="w-full max-w-sm p-8 space-y-4 shadow-lg bg-white/20 backdrop-blur-md rounded-3xl">
|
||||
<div className="text-2xl font-bold text-center text-white">เข้าสู่ระบบ</div>
|
||||
<div
|
||||
className="grid min-h-screen place-items-center"
|
||||
style={{
|
||||
background: "linear-gradient(to bottom right, #00c6ff, #0072ff)",
|
||||
}}
|
||||
>
|
||||
<form
|
||||
onSubmit={onSubmit}
|
||||
className="w-full max-w-sm p-8 space-y-4 shadow-lg bg-white/20 backdrop-blur-md rounded-3xl"
|
||||
>
|
||||
<div className="text-2xl font-bold text-center text-white">
|
||||
เข้าสู่ระบบ
|
||||
</div>
|
||||
<input
|
||||
disabled={isLoading}
|
||||
className="w-full p-3 text-white placeholder-gray-200 border bg-white/30 border-white/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-white/50 disabled:opacity-50"
|
||||
placeholder="ชื่อผู้ใช้"
|
||||
value={username}
|
||||
onChange={e=>setUsername(e.target.value)}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
@@ -61,15 +71,17 @@ export default function LoginPage() {
|
||||
className="w-full p-3 text-white placeholder-gray-200 border bg-white/30 border-white/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-white/50 disabled:opacity-50"
|
||||
placeholder="รหัสผ่าน"
|
||||
value={password}
|
||||
onChange={e=>setPassword(e.target.value)}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
{err && <div className="text-sm text-center text-yellow-300">{err}</div>}
|
||||
{err && (
|
||||
<div className="text-sm text-center text-yellow-300">{err}</div>
|
||||
)}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading}
|
||||
className="w-full p-3 font-bold text-white transition-colors duration-300 bg-blue-500 rounded-xl hover:bg-blue-600 disabled:bg-blue-400 disabled:cursor-not-allowed"
|
||||
>
|
||||
{isLoading ? 'กำลังเข้าสู่ระบบ...' : 'เข้าสู่ระบบ'}
|
||||
{isLoading ? "กำลังเข้าสู่ระบบ..." : "เข้าสู่ระบบ"}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user