Commit 98a2dd97 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

버튼숨기기

parent 670561f7
......@@ -3,7 +3,6 @@ import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom';
import styled from 'styled-components';
import { Navbar, Nav, NavLink } from 'react-bootstrap';
import axios from 'axios';
const MENU = styled(Navbar)`
background-color: #7B031D;
......
......@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu';
import axios from 'axios';
import { Link, Redirect } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.css';
function ACheck(props) {
const [state, setState] = useState()
......
......@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { Formik, Field, ErrorMessage, FieldArray } from 'formik';
import Menu from '../Components/Menu';
import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
import * as Yup from 'yup';
import { Redirect } from 'react-router-dom';
......
import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu';
import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
function Check(props) {
const [reserve, setReserve] = useState([]);
......
......@@ -6,11 +6,24 @@ import { Container, Row, Col, Card, Accordion, Button } from 'react-bootstrap';
function Notice() {
const [notices, setNotices] = useState([]);
const [user, setUser] = useState({ role: "" })
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 dateForm(day) {
const post_day = new Date(day);
let year = post_day.getFullYear();
......@@ -42,7 +55,10 @@ function Notice() {
<Container fluid>
<Row className="justify-content-center vw-100 vh-90">
<Col md={7}>
<h2 className="p-3 border-bottom">공지사항 <Link to="/write"> 작성</Link></h2>
<h2 className="p-3 border-bottom">공지사항
{user.role === "admin" ? (
<Link to="/write"> 작성</Link>) : null}</h2>
<Accordion>
{notices.map((notice, index) =>
<Card>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment