Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 관리자 로그인 페이지에서 스위치가 관리로 활성화되지 않는 버그 #469

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

jinhokim98
Copy link
Contributor

issue

구현 사항

관리자 로그인 페이지에서 스위치가 관리로 활성화되지 않는 버그를 해결했습니다.

관리자로 접속해서 들어간 페이지인데 관리가 활성화되지 않아서 유저가 나는 지금 어디있는거지라고 생각할 것 같아서, 너는 지금 관리페이지에 들어왔어 하지만 너는 "쿠키 is me"가 없기 때문에 관리할 수 없어 비밀번호 입력해! 라는 것을 더 잘 표시하기 위해 로그인 페이지에도 관리 탭이 활성화됐음을 강조했어요.

자세한 것은 영상으로

2024-08-21-23-56-45.mp4

추가로 useEventLogin 훅을 만들어서 EventLogin 관련 로직을 훅으로 분리했어요.

🫡 참고사항

Copy link
Contributor

@Todari Todari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

크... 섬세킹들이야 아주
감사합니다~!

Comment on lines +1 to +42
import {useState} from 'react';

import validateEventPassword from '@utils/validate/validateEventPassword';

import RULE from '@constants/rule';

import useRequestPostLogin from './queries/useRequestPostLogin';

const useEventLogin = () => {
const [password, setPassword] = useState('');
const [errorMessage, setErrorMessage] = useState<string | null>(null);
const [canSubmit, setCanSubmit] = useState(false);
const {mutate: postLogin} = useRequestPostLogin();

const submitPassword = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();

postLogin({password}, {onError: () => setErrorMessage('비밀번호가 틀렸어요')});
};

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const newValue = event.target.value;
const validation = validateEventPassword(newValue);
setErrorMessage(validation.errorMessage);

if (validation.isValid) {
setPassword(newValue);
}

setCanSubmit(newValue.length === RULE.maxEventPasswordLength);
};

return {
password,
errorMessage,
handleChange,
canSubmit,
submitPassword,
};
};

export default useEventLogin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

쿠키의 커스텀훅은 볼때마다 정말 놀라와...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋ 복붙이 끝이긴 하지만ㅋㅋ

Comment on lines +44 to +47
{
path: ROUTER_URLS.eventLogin,
element: <EventLoginPage />,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별도 페이지가 아니라, event 내부로 넣어버렸군뇨 좋와요~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

같은 형식의 url을 가지고 있어서 안으로 옮기고 중복되는 MainLayout TopNav를 지워봤어요!

Copy link
Contributor

@pakxe pakxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정말 귀신같이 버그를 찾으시네요

@pakxe pakxe merged commit 1e37410 into fe-dev Aug 21, 2024
1 check passed
@pakxe pakxe deleted the feature/#467 branch August 21, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[FE] 관리자 로그인 페이지에서 스위치가 관리로 활성화되지 않는 버그
3 participants