Skip to content

Commit

Permalink
Merge pull request #171 from bsideproject/moon
Browse files Browse the repository at this point in the history
[fix] 룸등록 step3 페이지이동 오류 수정
  • Loading branch information
KinDDoGGang authored Sep 27, 2023
2 parents 97809c0 + df1aedc commit c0c0a06
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
8 changes: 4 additions & 4 deletions pages/room/addRoom/step1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
Checkbox,
Button,
Input,
Calendar,
} from '@/components/index.tsx';
import { FieldValues, SubmitHandler, useForm } from 'react-hook-form';
import { GuList, DongList } from '@/public/js/guDongList.ts';
import { Option } from '@/components/Select/Select';
import Calendar from '@/components/Calendar/Calendar.tsx';
import Step2 from '@/pages/room/addRoom/step2.tsx'

interface GuDong extends Option {
Expand All @@ -22,7 +22,7 @@ interface GuDong extends Option {
}

export default function Step1() {
const { openModal, closeModal } = useModal();
const { openModal } = useModal();
const filterTranslation = useTranslation('filter');
const { register, handleSubmit, watch } = useForm({ mode: 'onChange' });
const [buttonState, setButtonState] = useState('YES');
Expand All @@ -32,6 +32,7 @@ export default function Step1() {
value: '',
label: '',
});

const [dongValue, setDongValue] = useState<GuDong>({
gu: '',
guLabel: '',
Expand Down Expand Up @@ -296,7 +297,7 @@ export default function Step1() {
<div className="w-full">
<div className="mb-[13px]">
<Button size="lg" type="submit" disabled={isNextStep()}
onClick={() => { console.log('dateAvailable', watch('dateAvailable'));}}
onClick={() => { watch('dateAvailable') }}
>
{filterTranslation.t('Next')}
</Button>
Expand All @@ -308,4 +309,3 @@ export default function Step1() {
</>
);
}

5 changes: 2 additions & 3 deletions pages/room/addRoom/step2.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from 'react';
import Router, { useRouter } from 'next/router';
import React, { useState } from 'react';
import {
Stepper,
Stepper2,
Expand All @@ -16,7 +15,7 @@ interface Step2Props {
}

export default function Step2({ step1Data }: Step2Props) {
const { openModal, closeModal } = useModal();
const { openModal } = useModal();
const { register, handleSubmit, watch, setValue } = useForm({ mode: 'onChange' });

const useButtonState = (initValue: string) => {
Expand Down
15 changes: 8 additions & 7 deletions pages/room/addRoom/step3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Upload
} from '@/components/index.tsx';
import { FieldValues, SubmitHandler, useForm } from 'react-hook-form';
import Router from 'next/router';
import { useRouter } from 'next/router';

interface Step2Props {
step1Data?: any;
Expand All @@ -23,20 +23,21 @@ export default function Step3({ step1Data, step2Data }: Step2Props) {
const { register, handleSubmit, watch } = useForm({ mode: 'onChange' });
const [imageList, setImageList] = useState<ImageListType>([]);
const [showComplete, setShowComplete] = useState(false);
const router = useRouter();

const onSubmit: SubmitHandler<FieldValues> = (data) => {
console.log('step1 Data', step1Data);
console.log('step2 Data', step2Data);
console.log('step3 Data', data);

setShowComplete(true);
};

const callbackImageList = (_imageList: ImageListType) => {
setImageList(_imageList);
}
const roomPostComplete = () => {
Router.push('/');
try {
// 라우팅이 안되요,,,, const result = router.push('/');
window.location.href= window.location.origin;
} catch(error) {
console.error('routingError', error);
}
}

return (
Expand Down
3 changes: 0 additions & 3 deletions pages/userInfo/myPostings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ interface MyPostingProps {

export default function MyPosting({ roomInfo }: MyPostingProps) {
const { openModal } = useModal();

const handleAddPosting = () => {
openModal({
props: {
Expand Down Expand Up @@ -57,14 +56,12 @@ export default function MyPosting({ roomInfo }: MyPostingProps) {
* 룸이 있을 때 보여주는 Component (TODO : 구체화 해줘야함)
*/
const MyRooms = () => {

return (
<div>
호이호이
</div>
);
};

return (
(roomInfo || []).length === 0 ? <NoPostings /> : <MyRooms />
)
Expand Down

0 comments on commit c0c0a06

Please sign in to comment.