Skip to content

Commit

Permalink
Merge pull request #197 from Igloo-Club/fes/register
Browse files Browse the repository at this point in the history
Fes/register
  • Loading branch information
SooY2 authored May 14, 2024
2 parents a070026 + 7013d6a commit f970c60
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/register/RegisterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const Register = () => {
faceDepictionList: [],
personalityDepictionList: [],
description: '',
markerList: [],
hobbyList: [],
disableCompany: false,
});
Expand Down Expand Up @@ -193,7 +192,9 @@ const Register = () => {
values={registerValues.hobbyList}
handleValues={handleValues}
onPrev={() => setStep('PersonalityDepiction')}
onNext={() => setStep('시간선택')}
onNext={() => {
setStep('시간선택');
}}
handleRegisterValue={handleRegisterValue}
registerValues={registerValues}
percent={90}
Expand Down
24 changes: 22 additions & 2 deletions src/register/components/HobbyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { HOBBY } from '../constants/profileConstants';
import { useState } from 'react';
import CheckBoxItem from './CheckBoxItem';
import { ExtendedNavTypesProps } from '../types/navTypes';
import { Registertypes } from '../types/registerTypes';
import instance from '../../common/apis/axiosInstanse';

interface HobbyListProps extends ExtendedNavTypesProps {
values: string[];
Expand All @@ -14,17 +16,35 @@ interface HobbyListProps extends ExtendedNavTypesProps {

const HobbyList = ({
values,
handleValues,
onNext,
onPrev,
registerValues,
}: HobbyListProps) => {
const [thisValues, setThisValues] = useState<string[]>(values);
const [thisRegisterValues] = useState<Registertypes>(registerValues);

const handleSubmit = () => {
handleValues(thisValues, 'hobbyList');
const updatedRegisterValues = {
...thisRegisterValues,
hobbyList: thisValues,
};
// 상태를 업데이트합니다.
console.log(updatedRegisterValues);
postSubmit(updatedRegisterValues);

onNext();
};

//데이터 보내기
const postSubmit = async (value: Registertypes) => {
console.log(value);
try {
await instance.patch('/api/member', value);
} catch (err) {
console.log(err);
}
};

return (
<StBackgroud>
<ArrowLeft onClick={() => onPrev()} />
Expand Down
1 change: 1 addition & 0 deletions src/register/funnelPages/RegisterSelectMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const 장소선택 = ({
...registerScheduleValues,
markerList: thisValues,
});
await instance.post('/api/nungil/addRecommendNungil', {});
onNext();
} catch (err) {
console.log(err);
Expand Down
13 changes: 6 additions & 7 deletions src/register/types/registerTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ export interface Registertypes {
contactInstagram?: string | null;
animalFace: string;
job: string;
height: number | string;
height?: number | string;
mbti: string;
marriageState: string;
religion: string;
alcohol: string;
smoke: string;
marriageState?: string;
religion?: string;
alcohol?: string;
smoke?: string;
faceDepictionList: string[];
personalityDepictionList: string[];
description: string;
disableCompany: boolean;
disableCompany?: boolean;
// 선택 사항
markerList?: string[];
hobbyList: string[];
}

0 comments on commit f970c60

Please sign in to comment.