-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.html
82 lines (70 loc) · 2.5 KB
/
view.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="ko-KR">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>이스트소프트 백엔드 개발 오르미 1기 모집</title>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/view.css">
</head>
<body>
<!-- header -->
<div class="header">
<h1><a href="index.html">HTML/CSS 실습</a></h1>
<div class="header-click">
<a href="chat.html">채팅</a>
<a href="login.html" id="login">로그인</a>
<a class="headerLink" id="profile" href="profile.html">회원정보수정</a>
<a class="headerLink" id="join" href="join.html">회원가입</a>
<a class="headerLink" id="logout" href="#">로그아웃</a>
</div>
</div>
<!-- // header -->
<div class="main">
<h2 class="main-title">글 조회</h2>
<div class="view">
<div class="view-header">
<h2 id="title"></h2>
<div class="view-info">
<p>작성자: <span id="autor"></span></p>|
<p>작성일: <span id="created_at"></span></p>|
</div>
</div>
<div class="view-content">
<p>내용</p>
</div>
<div class="view-content">
<p>설명</p>
</div>
</div>
<div class="btn-group">
<a href="./quote.html" class="btn">목록</a>
<a href="#" class="btn">수정</a>
<button type="button" class="btn">삭제</button>
</div>
</div>
<script src="js/controller.js"></script>
<script>
const params = new URL(location).searchParams;
const id = params.get('id')
getBoardView()
async function getBoardView() {
res = await securedApiRequest('quote/'+id, 'GET');
document.getElementById('title').innerText = res.title
document.getElementById('autor').innerText = res.user.email
const getDate = new Date(res.created_at)
document.getElementById('created_at').innerText = `${getDate.getFullYear()}.${getDate.getMonth()+Number(1)}.${getDate.getDate()}`
const $content = document.createElement('p')
$content.innerText=res.content
document.getElementsByClassName('view-content')[0].appendChild($content)
const $desc = document.createElement('p')
$desc.innerText=res.content
document.getElementsByClassName('view-content')[1].appendChild($desc)
}
</script>
<!-- footer -->
<p class="footer">Copyright 2023. Chilli All rights reserved.</p>
<!-- //footer -->
</body>
</html>