Skip to content

Commit

Permalink
홈 CTA 버튼 블링킹 (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyesungoh authored Aug 9, 2023
1 parent 14efe2d commit fe896d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.11",
"eslint-plugin-testing-library": "^5.10.3",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
"jsdom": "^21.1.1",
Expand All @@ -131,4 +131,4 @@
"vitest": "^0.32.0",
"webpack": "^5.79.0"
}
}
}
8 changes: 6 additions & 2 deletions src/features/home/ConditionalCtaLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import useGetSurveyIdByUserStatus from '~/hooks/api/surveys/useGetSurveyIdByUser
const ConditionalCtaLink = () => {
const [isNotFound, setIsNotFound] = useState(false);

const { data, sessionStatus } = useGetSurveyIdByUserStatus({
const { data, sessionStatus, isLoading } = useGetSurveyIdByUserStatus({
onError: (error) => {
if (error.code === 404) {
setIsNotFound(true);
}
},
});

if (data) return <ResultLink surveyId={data.survey_id} />;
if (sessionStatus === 'loading') return null;
if (sessionStatus === 'unauthenticated') return <CreateQuestionFormLink />;

if (isLoading) return null;
if (isNotFound) return <CreateQuestionFormLink />;

if (data) return <ResultLink surveyId={data.survey_id} />;

return <CreateQuestionFormLink />;
};

Expand Down
2 changes: 2 additions & 0 deletions src/features/home/KakaoLoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { BODY_1 } from '~/styles/typo';
const KakaoLoginButton = () => {
const { logOutHandler, loginHandler, status } = useKakaoLogin();

if (status === 'loading') return null;

if (status === 'authenticated') {
return (
<div css={KakaoLoginWrapper}>
Expand Down

0 comments on commit fe896d8

Please sign in to comment.