HomePage.js 2.51 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import React, { useState, useEffect } from 'react';
CHAERIN KIM's avatar
CHAERIN KIM committed
2
3
import { Redirect } from 'react-router-dom';
import axios from 'axios';
Kim, Subin's avatar
Kim, Subin committed
4
import Menu from '../Components/Menu';
Kim, Subin's avatar
Kim, Subin committed
5
import Schedule from '../Components/Schedule';
Kim, Subin's avatar
Kim, Subin committed
6
import { Container, Tabs, Tab } from 'react-bootstrap';
Kim, Subin's avatar
기간    
Kim, Subin committed
7

Kim, Subin's avatar
Kim, Subin committed
8
function Home() {
Kim, Subin's avatar
Kim, Subin committed
9
    const [key, setKey] = useState('9-116');
CHAERIN KIM's avatar
CHAERIN KIM committed
10
    const [state, setState] = useState()
Kim, Subin's avatar
기간    
Kim, Subin committed
11
12

    useEffect(() => {
CHAERIN KIM's avatar
CHAERIN KIM committed
13
        tcheck();
Kim, Subin's avatar
기간    
Kim, Subin committed
14
15
    }, []);

CHAERIN KIM's avatar
CHAERIN KIM committed
16
    if (state) return <Redirect to="/" />;
Kim, Subin's avatar
Home    
Kim, Subin committed
17

CHAERIN KIM's avatar
CHAERIN KIM committed
18
19
20
21
22
23
24
25
26
27
28
29
30
    function tcheck() {
        axios.get(`/users/${localStorage.getItem('_id')}`, {
            headers: { authorization: localStorage.getItem('token') },
        })
            .then(res => {
                if (res.status !== 201) {
                    alert(res.data.error);
                    localStorage.clear();
                    setState(true);
                }
            }).catch(err => {
                alert(err.error)
            });
Kim, Subin's avatar
Kim, Subin committed
31
    }
Kim, Subin's avatar
Kim, Subin committed
32

Kim, Subin's avatar
Kim, Subin committed
33
34
35
    return (
        <div>
            <Menu />
Kim, Subin's avatar
Kim, Subin committed
36
            <Container className="col-md-10 mt-3">
Lee Jin Ju's avatar
Lee Jin Ju committed
37
38
39
                <h2>대관 현황</h2>
                <p>
                    <strong>대관 가능 시간</strong>
Ha YeaJin's avatar
Ha YeaJin committed
40
                    <ul className="pl-4">
Lee Jin Ju's avatar
Lee Jin Ju committed
41
42
43
44
                        <li>평일: 9 - 22/ 예약가능 시간 이후 폐쇄</li>
                        <li>주말: 이용 불가</li>
                    </ul>
                </p>
Kim, Subin's avatar
Kim, Subin committed
45
46
47
                <p>
                    <strong>유의사항</strong>
                    <ul className="pl-4">
Kim, Subin's avatar
Kim, Subin committed
48
                        <li>강의실 사용시 최소인원 수에 맞춰서 명단 작성이 필요합니다.</li>
Kim, Subin's avatar
Kim, Subin committed
49
50
51
52
                        <li>1 대관시 최대 3시간까지 이용이 가능합니다. (1시간 단위로 대관 가능)</li>
                        <li><strong style={{ color: "red" }}>대관 시간 이외 강의실을 이용하다 적발될 경우 한달  강의실 이용이 불가합니다.</strong></li>
                    </ul>
                </p>
Kim, Subin's avatar
Kim, Subin committed
53
                <Tabs defaultActiveKey="9-116" id="uncontrolled-tab-example" onSelect={(k) => setKey(k)}>
Kim, Subin's avatar
Kim, Subin committed
54
                    <Tab eventKey="9-116" title="9-116">
CHAERIN KIM's avatar
CHAERIN KIM committed
55
                        <Schedule room={key} />
Kim, Subin's avatar
Kim, Subin committed
56
57
                    </Tab>
                    <Tab eventKey="7-234" title="7-234">
CHAERIN KIM's avatar
CHAERIN KIM committed
58
                        <Schedule room={key} />
Kim, Subin's avatar
Kim, Subin committed
59
60
                    </Tab>
                    <Tab eventKey="25-101" title="25-101">
CHAERIN KIM's avatar
CHAERIN KIM committed
61
                        <Schedule room={key} />
Kim, Subin's avatar
Kim, Subin committed
62
63
                    </Tab>
                </Tabs>
Kim, Subin's avatar
Kim, Subin committed
64
            </Container>
Kim, Subin's avatar
Kim, Subin committed
65
66
67
68
        </div>
    )
}

Kim, Subin's avatar
Kim, Subin committed
69
export default Home