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

refactor: 로그인 안했을 때 토스트 메시지 띄워주도록 #887

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants/helperText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const COMMON = {
success: {},
error: {
required: '필수 정보입니다.',
requiredLogin: '로그인이 필요합니다.',
onlyNumber: '숫자만 입력 가능합니다.',
onlyHttps: 'https:// 로 시작해야 합니다.',
minLength: (min: number) => `${min}글자 이상 입력해주세요.` as const,
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Study/Modal/StudyModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Controller, useForm } from 'react-hook-form';
import toast from 'react-hot-toast';
import { useQueryClient } from 'react-query';
import { InputLabel, Stack, Typography, useMediaQuery, useTheme } from '@mui/material';
import { SiNotion } from 'react-icons/si';
Expand Down Expand Up @@ -146,6 +147,9 @@ const StudyModal = ({ open, setOpen, selectedStudyInfo, setSelectedStudyInfo, cu
group: member.generation,
})) || []),
]);
} else if (open && !headMemberInfo) {
toast.error(COMMON.error.requiredLogin);
setOpen(false);
}
}, [open, headMemberInfo]);

Expand Down
Loading