file rename
This commit is contained in:
@@ -3,14 +3,14 @@ import React from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
type LoginOptionProps = {
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
loginErrorModalEnabled?: boolean;
|
||||
setLoginErrorModalEnabled?: (enabled: boolean) => void;
|
||||
};
|
||||
|
||||
export default function LoginOption({
|
||||
className,
|
||||
className,
|
||||
loginErrorModalEnabled,
|
||||
setLoginErrorModalEnabled,
|
||||
}: LoginOptionProps) {
|
||||
@@ -18,7 +18,7 @@ export default function LoginOption({
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
|
||||
return (
|
||||
return (
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
@@ -26,7 +26,7 @@ export default function LoginOption({
|
||||
className={`fixed bottom-2 right-2 bg-red-400 cursor-pointer rounded-full w-[40px] h-[40px] shadow-xl z-100`}
|
||||
>
|
||||
</button>
|
||||
{ isOpen && (
|
||||
{isOpen && (
|
||||
<div className="fixed inset-0 flex items-center justify-center z-50">
|
||||
<div className="w-[500px] h-[600px] flex bg-white/80 p-10 border rounded-lg relative">
|
||||
<button
|
||||
@@ -37,25 +37,25 @@ export default function LoginOption({
|
||||
>
|
||||
×
|
||||
</button>
|
||||
<ul className="flex flex-col gap-4">
|
||||
<li className="flex items-center justify-between">
|
||||
<p className="mr-4">login error modal</p>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="login error modal 토글"
|
||||
aria-pressed={!!loginErrorModalEnabled}
|
||||
onClick={() => setLoginErrorModalEnabled?.(!loginErrorModalEnabled)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${loginErrorModalEnabled ? 'bg-blue-600' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-block h-5 w-5 transform rounded-full bg-white transition ${loginErrorModalEnabled ? 'translate-x-5' : 'translate-x-1'}`}
|
||||
/>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className="flex flex-col gap-4">
|
||||
<li className="flex items-center justify-between">
|
||||
<p className="mr-4">login error modal</p>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="login error modal 토글"
|
||||
aria-pressed={!!loginErrorModalEnabled}
|
||||
onClick={() => setLoginErrorModalEnabled?.(!loginErrorModalEnabled)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${loginErrorModalEnabled ? 'bg-blue-600' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-block h-5 w-5 transform rounded-full bg-white transition ${loginErrorModalEnabled ? 'translate-x-5' : 'translate-x-1'}`}
|
||||
/>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
);
|
||||
}
|
||||
@@ -19,8 +19,8 @@ export default function LoginPage() {
|
||||
const [isUserIdFocused, setIsUserIdFocused] = useState(false);
|
||||
const [isPasswordFocused, setIsPasswordFocused] = useState(false);
|
||||
const [isLoginErrorOpen, setIsLoginErrorOpen] = useState(false);
|
||||
const [idError, setIdError] = useState("");
|
||||
const [passwordError, setPasswordError] = useState("");
|
||||
const [idError, setIdError] = useState("");
|
||||
const [passwordError, setPasswordError] = useState("");
|
||||
|
||||
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
|
||||
e.preventDefault();
|
||||
@@ -31,7 +31,7 @@ export default function LoginPage() {
|
||||
try {
|
||||
const response = await fetch("https://hrdi.coconutmeet.net/auth/login", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json",},
|
||||
headers: { "Content-Type": "application/json", },
|
||||
body: JSON.stringify({
|
||||
email: userId,
|
||||
password: password
|
||||
@@ -61,7 +61,7 @@ export default function LoginPage() {
|
||||
|
||||
const data = await response.json();
|
||||
console.log("로그인 성공:", data);
|
||||
|
||||
|
||||
// 로그인 성공 시 토큰 저장 (다양한 필드명 지원)
|
||||
const token = data.token || data.accessToken || data.access_token;
|
||||
if (token) {
|
||||
@@ -73,11 +73,11 @@ export default function LoginPage() {
|
||||
console.warn("토큰이 응답에 없습니다. 응답 데이터:", data);
|
||||
// 토큰이 없어도 로그인은 성공했으므로 진행
|
||||
}
|
||||
|
||||
|
||||
// 리다이렉트 경로 확인
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const redirectPath = searchParams.get('redirect') || '/';
|
||||
|
||||
|
||||
// 메인 페이지로 이동
|
||||
router.push(redirectPath);
|
||||
} catch (error) {
|
||||
@@ -94,18 +94,18 @@ export default function LoginPage() {
|
||||
open={isLoginErrorOpen}
|
||||
onClose={() => setIsLoginErrorOpen(false)}
|
||||
/>
|
||||
<LoginOption
|
||||
<LoginOption
|
||||
onClick={() => setIsLoginErrorOpen(true)}
|
||||
loginErrorModalEnabled={isLoginErrorOpen}
|
||||
setLoginErrorModalEnabled={setIsLoginErrorOpen}
|
||||
loginErrorModalEnabled={isLoginErrorOpen}
|
||||
setLoginErrorModalEnabled={setIsLoginErrorOpen}
|
||||
/>
|
||||
|
||||
<div className="rounded-xl bg-white max-w-[560px] px-[40px] w-full">
|
||||
{/* 로고 영역 */}
|
||||
<div className="my-15 flex flex-col items-center">
|
||||
<div className="mb-[7px]">
|
||||
<MainLogo/>
|
||||
</div>
|
||||
<div className="mb-[7px]">
|
||||
<MainLogo />
|
||||
</div>
|
||||
<div className="text-[28.8px] font-extrabold leading-[145%] text-neutral-700" >
|
||||
XR LMS
|
||||
</div>
|
||||
@@ -249,11 +249,10 @@ export default function LoginPage() {
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<p className="text-center py-[40px] text-[15px] text-basic-text">
|
||||
Copyright ⓒ 2025 XL LMS. All rights reserved
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user