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