Skip to content

Commit

Permalink
[FE] fix : 공지사항 생성시 바로 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
urimeee committed May 28, 2024
1 parent 7a0e3c8 commit e1a500f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions frontend/moim_front/src/pages/MoimJoinPage/MoimHome/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { GET, POST } from "../../../utils/axios";
import CreationModal from "../../../components/CreationModal";
import { IndeterminateCheckBox, SettingsOutlined } from "@mui/icons-material";
import { fetchMeetings } from "../../../api/moim";
function MoimHome({ notices, isHost, moimId }) {
import { fetchNotices } from "../../../api/moim";
function MoimHome({ isHost, moimId }) {
const [showModal, setShowModal] = useState(false);
const [meetingOption, setMeetingOption] = useState("UPCOMING");

Expand All @@ -16,6 +17,7 @@ function MoimHome({ notices, isHost, moimId }) {
const [noticeContent, setNoticeContent] = useState("");
const [noticeDate, setNoticeDate] = useState("");
const [open, setOpen] = useState(false);
const [notices, setNotices] = useState([]);

const navigate = useNavigate();

Expand Down Expand Up @@ -49,8 +51,16 @@ function MoimHome({ notices, isHost, moimId }) {
contents: noticeContent,
};
const response = await POST("api/moims/notices", data);

console.log(response.data);
getNotices();
} catch (e) {
console.log(e);
}
};
const getNotices = async () => {
try {
const result = await fetchNotices(moimId);
console.log(result);
setNotices(result.data.data);
} catch (e) {
console.log(e);
}
Expand All @@ -74,6 +84,7 @@ function MoimHome({ notices, isHost, moimId }) {
};
useEffect(() => {
getMeetings();
getNotices();
}, []);
useEffect(() => {
getMeetings();
Expand Down

0 comments on commit e1a500f

Please sign in to comment.