-
Notifications
You must be signed in to change notification settings - Fork 0
공용 모달 적용 #172
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
Merged
공용 모달 적용 #172
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2f73863
style : 태블릿 웹 반응형 수정
layout-SY cdbca69
Merge branch 'develop' of https://github.com/D3vPals/frontend into fe…
layout-SY 8ade996
refactor : 공용 ref 훅으로 변경
layout-SY 14954c0
refactor : 공용 모달 추가하며 각 컴포넌트 hook 추가
layout-SY 99f9bba
refactor : 상세 공고 페이지 로딩 스피너 추가
layout-SY 495ddbc
Merge branch 'develop' of https://github.com/D3vPals/frontend into fe…
layout-SY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import { MODAL_MESSAGE } from '../constants/modalMessage'; | ||
| import { postApplicantProject } from '../api/joinProject.api'; | ||
| import { ROUTES } from '../constants/routes'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { joinProject } from '../models/joinProject'; | ||
|
|
||
| interface UseApplyProjectProps { | ||
| id: number; | ||
| handleModalOpen: (newMessage: string) => void; | ||
| } | ||
|
|
||
| const useApplyProject = ({ id, handleModalOpen }: UseApplyProjectProps) => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| const mutation = useMutation({ | ||
| mutationFn: (formData: joinProject) => postApplicantProject(formData, id), | ||
| onSuccess: () => { | ||
| handleModalOpen(MODAL_MESSAGE.applyProjectSuccess); | ||
|
|
||
| setTimeout(() => { | ||
| navigate(ROUTES.main); | ||
| }, 3000); | ||
| }, | ||
| onError: (error) => { | ||
| console.log(error); | ||
| handleModalOpen(MODAL_MESSAGE.applyProjectFail); | ||
| }, | ||
| }); | ||
|
|
||
| const applyProject = async (formData: joinProject) => { | ||
| mutation.mutate(formData); | ||
| }; | ||
|
|
||
| return { | ||
| applyProject, | ||
| isLoading: mutation.isPending, | ||
| isError: mutation.isError, | ||
| error: mutation.error, | ||
| isSuccess: mutation.isSuccess, | ||
| }; | ||
| }; | ||
|
|
||
| export default useApplyProject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import { FormData } from '../models/createProject'; | ||
| import { MODAL_MESSAGE } from '../constants/modalMessage'; | ||
| import { postProject } from '../api/joinProject.api'; | ||
| import { Dispatch, SetStateAction } from 'react'; | ||
| import { useSaveSearchFiltering } from './useSaveSearchFiltering'; | ||
| import { ROUTES } from '../constants/routes'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
|
|
||
| interface UseCreateProjectProps { | ||
| handleModalOpen: (newMessage: string) => void; | ||
| setIsSubmit: Dispatch<SetStateAction<boolean>>; | ||
| } | ||
|
|
||
| const useCreateProject = ({ | ||
| handleModalOpen, | ||
| setIsSubmit, | ||
| }: UseCreateProjectProps) => { | ||
| const navigate = useNavigate(); | ||
| const { handleUpdateFilters } = useSaveSearchFiltering(); | ||
|
|
||
| const mutation = useMutation({ | ||
| mutationFn: (formData: FormData) => postProject(formData), | ||
| onSuccess: () => { | ||
| handleModalOpen(MODAL_MESSAGE.createProjectSuccess); | ||
| setIsSubmit(true); | ||
| handleUpdateFilters('skillTag', []); | ||
|
|
||
| setTimeout(() => { | ||
| navigate(ROUTES.main); | ||
| }, 3000); | ||
| }, | ||
| onError: (error) => { | ||
| console.log(error); | ||
| handleModalOpen(MODAL_MESSAGE.createProjectFail); | ||
| }, | ||
| }); | ||
|
|
||
| const createProject = async (formData: FormData) => { | ||
| mutation.mutate(formData); | ||
| }; | ||
|
|
||
| return { | ||
| createProject, | ||
| isLoading: mutation.isPending, | ||
| isError: mutation.isError, | ||
| error: mutation.error, | ||
| isSuccess: mutation.isSuccess, | ||
| }; | ||
| }; | ||
|
|
||
| export default useCreateProject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useOutsideClick을 활용해서 로직이 더 간결해 졌네요! 감사합니다~