Skip to content

Commit

Permalink
Merge pull request #99 from Beside-Potenday/seungbeom
Browse files Browse the repository at this point in the history
feat: 메일생성하기 모달 창 띄우기
  • Loading branch information
seung365 authored Aug 8, 2024
2 parents cac19e7 + c810fd5 commit c0c32b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/api/hooks/Mail/useGetMail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const createApiClient = (job: string) => {

const getMail = async (page: number, size: number, job: string) => {
try {
console.log('business', page, size);
console.log(job, page, size);
const apiClient = createApiClient(job);
const response = await apiClient.get<MailListResponse>(getMailPath(page, size));
return response.data;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/Header/HeaderWithout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Header = () => {
subject: '',
receiver: '',
});
navigate(RouterPath.mail);
navigate(RouterPath.mail, { state: { openModal: true } }); // Pass state to indicate modal should open
};

const { authInfo } = useAuth();
Expand Down
12 changes: 8 additions & 4 deletions src/pages/Mail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ import { AskList } from '@/components/Mail/AskList';
import { useMail } from '@/Provider/MailContext';
import { MailModal } from '@/components/Mail/MailModal';
import { breakpoints } from '@/styles/variants';
import { useLocation } from 'react-router-dom';

export const MailPage = () => {
const { isOpen, onOpen, onClose } = useDisclosure();
const [isAlertOpen, setAlertOpen] = useState(true);
const mailContext = useMail();
const { isActive } = useMail();

const location = useLocation();

if (!mailContext) {
throw new Error('MailContext not found');
}
Expand All @@ -46,7 +49,10 @@ export const MailPage = () => {

useEffect(() => {
window.scrollTo(0, 0);
}, []);
if (location.state?.openModal) {
setAlertOpen(true);
}
}, [location]);

return (
<Wrapper>
Expand Down Expand Up @@ -122,9 +128,7 @@ const CustomAlert: React.FC<CustomAlertProps> = ({ isOpen, onClose }) => {
<ModalOverlay />
<ModalContent>
<ModalHeader>✉️알파메일이 처음이신가요✉️</ModalHeader>
<ModalBody>
상단바에서 대학생, 직장인 중 해당되는 것을 눌러 메일을 생성해봐요!
</ModalBody>
<ModalBody>상단바에서 대학생, 직장인 중 해당되는 것을 눌러 메일을 생성해봐요!</ModalBody>
<ModalFooter>
<Button colorScheme="blue" onClick={onClose}>
닫기
Expand Down
1 change: 0 additions & 1 deletion src/pages/MyPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
HStack,
Text,
Avatar,
Heading,
Divider,
Button,
Spinner,
Expand Down

0 comments on commit c0c32b2

Please sign in to comment.