Skip to content

Commit

Permalink
Merge pull request #222 from bsideproject/feature/user
Browse files Browse the repository at this point in the history
[feat] User Posting Rooms 조회!
  • Loading branch information
KinDDoGGang authored Dec 6, 2023
2 parents 3ee0a5b + 72af638 commit 0698678
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pages/userInfo/myPostings.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/no-unstable-nested-components */
import React from 'react';
import React, { useState, useEffect } from 'react';
import NoPosting from '@/public/icons/noPosting.svg';
import Step1 from '@/pages/room/addRoom/step1.tsx';
import useModal from '@/hooks/useModal';
import DefaultLayout from '@/components/layouts/DefaultLayout';
import { Nav } from '@/components/index.tsx';
import { getRooms } from '@/api/room';
import { RoomSearch } from '@/public/types/room';
// import { useRouter } from 'next/router';

// TODO 데이터가 구체화되면 바꿔줘야함
Expand All @@ -14,6 +17,7 @@ interface MyPostingProps {

export default function MyPosting({ roomInfo }: MyPostingProps) {
const { openModal } = useModal();
const [myRooms, setMyRooms] = useState<RoomSearch[]>([]);
const handleAddPosting = () => {
openModal({
props: {
Expand All @@ -26,6 +30,15 @@ export default function MyPosting({ roomInfo }: MyPostingProps) {
});
};

useEffect(() => {
const fetchData = async () => {
const data = await getRooms({ page: 0 });
setMyRooms((prevRooms) => [...prevRooms, ...(data?.content || [])]);
console.log('data', data);
};
fetchData();
}, []);

/**
* 룸이 없을 때 보여주는 Component
*/
Expand Down

0 comments on commit 0698678

Please sign in to comment.