Skip to content

Commit

Permalink
Refactor/#118: Dropdown default 값으로 '선택 안 함' 옵션 추가 (#120)
Browse files Browse the repository at this point in the history
* fix: 게시글 수정하기 시 id가 feedId 대신 memberId로 잘못 넘어가던 오류 수정

* refactor: 글쓰기 지역 미선택 시 '선택 안 함' id로 고정되도록 변경

* refactor: 회원가입 및 프로필 수정 서버 API '선택 안 함' 수정 사항 대응
  • Loading branch information
semnil5202 authored Apr 22, 2024
1 parent ec90214 commit e1b48a2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/pages/FeedDetail/FeedDetail.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const FeedDetailPage = () => {
const { deleteIdea } = useDeleteIdea();

const onModifyFeedDetail = () => {
navigate('/write-edit', { state: { ideaId: memberId } });
navigate('/write-edit', { state: { ideaId: feedId } });
};

const onDeleteFeedDetail = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfileEdit/ProfileEdit.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const ProfileEdit = () => {
profileImageUrl: my.profileImageUrl || '',
skills: selectedSkillDepths.map(({ id, name }) => ({ skillId: id, level: name.split(', ')[1] })),
joinPurposes: checkboxValue.goal.filter(({ checked }) => checked).map(({ id }) => id),
livingPlace: dropdownValue.region || null,
livingPlace: dropdownValue.region === '선택 안 함' ? null : dropdownValue.region,
workingPlace: fieldValue.company,
introduction: fieldValue.intro,
});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SignUp/SignUp.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const SignUpPage = () => {
profileImageUrl: memberInfo?.profileImageUrl || '',
skills: selectedSkillDepths.map(({ id, name }) => ({ skillId: id, level: name.split(', ')[1] })),
joinPurposes: checkboxValue.goal.filter(({ checked }) => checked).map(({ id }) => id),
livingPlace: dropdownValue.region || null,
livingPlace: dropdownValue.region === '선택 안 함' ? null : dropdownValue.region,
workingPlace: fieldValue.company,
introduction: fieldValue.intro,
email: memberInfo?.email || '',
Expand Down
21 changes: 1 addition & 20 deletions src/pages/SignUp/hooks/useSignUpQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,6 @@ const SKILL_DEPTH_THREE_LIST = [
{ id: 3, name: '하' },
];

const REGION_LIST = [
{ id: 1, name: '서울특별시' },
{ id: 2, name: '부산광역시' },
{ id: 3, name: '대구광역시' },
{ id: 4, name: '인천광역시' },
{ id: 5, name: '광주광역시' },
{ id: 6, name: '울산광역시' },
{ id: 7, name: '세종특별자치시' },
{ id: 8, name: '경기도' },
{ id: 9, name: '강원특별자치도' },
{ id: 10, name: '충청북도' },
{ id: 11, name: '충청남도' },
{ id: 12, name: '전라북도' },
{ id: 13, name: '전라남도' },
{ id: 14, name: '경상북도' },
{ id: 15, name: '경상남도' },
{ id: 16, name: '제주특별자치도' },
];

const useSignUpQuery = () => {
const { data } = useSuspenseQuery({
queryKey: ['GetSignUp'],
Expand All @@ -40,7 +21,7 @@ const useSignUpQuery = () => {
mainSkills,
detailSkills,
skillLevels: SKILL_DEPTH_THREE_LIST,
regions: REGION_LIST,
regions: data.regionResponses,
purposes,
};
},
Expand Down
6 changes: 6 additions & 0 deletions src/pages/SignUp/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ export interface Skill {
name: string;
}

interface Region {
id: number;
name: string;
}

export interface GetSignUp {
mainSkillResponses: MainSkillOption[];
purposeResponses: CheckboxOption[];
regionResponses: Region[];
}

export interface MainSkillOption {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Write/Write.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const WritePage = () => {
}

const writeIdea = () => {
const recruitmentPlaceId = recruitmentPlaces.find((place) => place.name === dropdownValue.recruitmentPlace)?.id;
const recruitmentPlaceId =
recruitmentPlaces.find((place) => place.name === dropdownValue.recruitmentPlace)?.id || 1;
const skillCategoryIds = selectedSkillResponses.map((selectedSkillResponse) => selectedSkillResponse.id);

// TODO: 글쓰기 필수 조건 누락 시 토스트 띄워주기 (alert -> toast)
Expand Down

0 comments on commit e1b48a2

Please sign in to comment.