Skip to content

Commit

Permalink
πŸ› fix : 곡고 μˆ˜μ • μ‹œ api λͺ…μ„Έ λ³€κ²½μœΌλ‘œ μΈν•œ μžλ™ μž…λ ₯ λˆ„λ½ μˆ˜μ • #127
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMirror21 committed Jan 24, 2025
1 parent f01332b commit df27ec8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Employer/PostCreate/Step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Step2 = ({
handleAddressSearch, // 검색할 μ£Όμ†Œ μž…λ ₯ μ‹œ μ‹€μ‹œκ°„ 검색
handleAddressSelect, // 검색 κ²°κ³Ό 쀑 μ›ν•˜λŠ” μ£Όμ†Œλ₯Ό 선택할 μ‹œ state에 μž…λ ₯
setAddressInput,
} = useAddressSearch();
} = useAddressSearch(postInfo.body.address);

const handleAddressSelection = (selectedAddressName: string) => {
const result = handleAddressSelect(selectedAddressName);
Expand Down
13 changes: 9 additions & 4 deletions src/hooks/api/useAddressSearch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useSearchAddress } from '@/hooks/api/useKaKaoMap';
import { Document, AddressType, GeoPosition } from '@/types/api/map';
import { Address } from '@/types/postCreate/postCreate';
import { pick } from '@/utils/map';
import { Dispatch, SetStateAction, useCallback, useState } from 'react';

Expand Down Expand Up @@ -27,14 +28,18 @@ interface UseAddressSearchReturn {
setCurrentGeoInfo: Dispatch<SetStateAction<GeoPosition>>;
}

export const useAddressSearch = (): UseAddressSearchReturn => {
const [addressInput, setAddressInput] = useState('');
export const useAddressSearch = (
addressBeforeEdit?: Address,
): UseAddressSearchReturn => {
const [addressInput, setAddressInput] = useState(
addressBeforeEdit?.address_name || '',
);
const [addressSearchResult, setAddressSearchResult] = useState<Document[]>(
[],
);
const [currentGeoInfo, setCurrentGeoInfo] = useState({
lat: 0,
lon: 0,
lat: addressBeforeEdit?.latitude || 0,
lon: addressBeforeEdit?.longitude || 0,
});

const { searchAddress } = useSearchAddress({
Expand Down
15 changes: 11 additions & 4 deletions src/pages/Employer/Post/EmployerEditPostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const EmployerEditPostPage = () => {
const { isEdit } = location.state || {};
const { id } = useParams();
const { currentPostId } = useCurrentPostIdStore();
console.log(currentPostId)
console.log(currentPostId);
const [currentStep, setCurrentStep] = useState(1);
const [postInfo, setPostInfo] = useState<JobPostingForm>(
initialJobPostingState,
Expand Down Expand Up @@ -56,8 +56,15 @@ const EmployerEditPostPage = () => {
work_period: serverData.working_conditions.work_period,
hourly_rate: serverData.working_conditions.hourly_rate,
employment_type: serverData.working_conditions.employment_type,
address: {...postInfo.body.address, address_name: serverData.company_information.company_address},
recruitment_dead_line: serverData.recruitment_conditions.recruitment_deadline,
address: {
...postInfo.body.address,
address_name: serverData.workplace_information.main_address,
latitude: serverData.workplace_information.latitude,
longitude: serverData.workplace_information.longitude,
address_detail: serverData.workplace_information.detailed_address,
},
recruitment_dead_line:
serverData.recruitment_conditions.recruitment_deadline,
recruitment_number: serverData.recruitment_conditions.number_of_recruits,
gender: serverData.recruitment_conditions.gender,
age_restriction: initialJobPostingState.body.age_restriction,
Expand Down Expand Up @@ -107,7 +114,7 @@ const EmployerEditPostPage = () => {
length={5}
currentStep={currentStep}
mainColor="#1E1926"
textColor='#FFFFFF'
textColor="#FFFFFF"
/>
</div>
<div className="w-full flex justify-center px-6">
Expand Down

0 comments on commit df27ec8

Please sign in to comment.