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'; ...@@ -3,7 +3,6 @@ import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import styled from 'styled-components'; import styled from 'styled-components';
import { Navbar, Nav, NavLink } from 'react-bootstrap'; import { Navbar, Nav, NavLink } from 'react-bootstrap';
import axios from 'axios';
const MENU = styled(Navbar)` const MENU = styled(Navbar)`
background-color: #7B031D; background-color: #7B031D;
......
...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.css';
function ACheck(props) { function ACheck(props) {
const [state, setState] = useState() const [state, setState] = useState()
......
...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { Formik, Field, ErrorMessage, FieldArray } from 'formik'; import { Formik, Field, ErrorMessage, FieldArray } from 'formik';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
import * as Yup from 'yup'; import * as Yup from 'yup';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
function Check(props) { function Check(props) {
const [reserve, setReserve] = useState([]); const [reserve, setReserve] = useState([]);
......
...@@ -6,11 +6,24 @@ import { Container, Row, Col, Card, Accordion, Button } from 'react-bootstrap'; ...@@ -6,11 +6,24 @@ import { Container, Row, Col, Card, Accordion, Button } from 'react-bootstrap';
function Notice() { function Notice() {
const [notices, setNotices] = useState([]); const [notices, setNotices] = useState([]);
const [user, setUser] = useState({ role: "" })
useEffect(() => { useEffect(() => {
acheck();
getNotice(); 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) { function dateForm(day) {
const post_day = new Date(day); const post_day = new Date(day);
let year = post_day.getFullYear(); let year = post_day.getFullYear();
...@@ -42,7 +55,10 @@ function Notice() { ...@@ -42,7 +55,10 @@ function Notice() {
<Container fluid> <Container fluid>
<Row className="justify-content-center vw-100 vh-90"> <Row className="justify-content-center vw-100 vh-90">
<Col md={7}> <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> <Accordion>
{notices.map((notice, index) => {notices.map((notice, index) =>
<Card> <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