import React, { useState, useEffect, useRef } from 'react'; import Menu from '../Components/Menu'; import axios from 'axios'; import { Link } from 'react-router-dom'; import { Container, Row, Col, Button, Accordion } from 'react-bootstrap'; import CARD from '../Components/Card'; function Notice() { const [user, setUser] = useState({ role: "" }) const [notices, setNotices] = useState([]); // const [show, setShow] = useState(false); useEffect(() => { acheck(); getNotice(); }, []); function acheck() { axios.get(`/users/${localStorage.getItem('_id')}`) .then(res => { if (res.data.role == "admin") { setUser(res.data) } }).catch(err => { alert(err.error) }); } function getNotice() { axios.get(`/notices`) .then(res => { if (res.status !== 201) { // alert(res.data.error); } setNotices(res.data); }) .catch(err => { alert(err.error) }); } return (

공지사항 {user.role === "admin" ? ( ) : null}

{notices.map((notice, index) => )} {/* setShow(!show)}>{notice.notice_title} {dateForm(notice.post_date)}
{notice.notice_content}
*/}
) } export default Notice;