-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
137 lines (108 loc) · 3.58 KB
/
admin.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html lang="en">
<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>Admin</title>
<style>
#admin,
#workout {
border: 1px solid black;
display: grid;
align-items: center;
justify-content: center;
width: 400px;
margin: auto;
margin-top: 10vh;
margin-bottom: 200px;
}
#admin input,
#workout input {
display: block;
margin: 20px;
height: 30px;
width: 300px;
}
#btn,
#btn1 {
display: block;
width: 100px;
margin-left: 150px;
height: 30px;
}
</style>
</head>
<body>
<div id="admin">
<form>
<input type="text" id="smallImg" placeholder="interUrl" />
<input type="text" id="title" placeholder="Enter title" />
<input type="text" id="Sort" placeholder="Enter Short Details" />
<input type="text" id="video" placeholder="Enter Video Url" />
<input type="text" id="bigImg" placeholder="Enter Image Url" />
<input type="text" id="muscleGroup" placeholder="Enter muscleGroup" />
<input type="text" id="steps" placeholder="Enter Steps" />
<input type="text" id="tips" placeholder="Enter Tips" />
<input type="text" id="warning" placeholder="Enter warning" />
</form>
<button id="btn">Add</button>
</div>
<div id="workout">
<form>
<input type="text" id="smallImg1" placeholder="interUrl1" />
<input type="text" id="title1" placeholder="Enter title1" />
<input type="text" id="Sort1" placeholder="Enter Short Details1" />
<input type="text" id="video1" placeholder="Enter Video Url1" />
<input type="text" id="bigImg1" placeholder="Enter Image Url1" />
</form>
<button id="btn1">Add</button>
</div>
</body>
</html>
<script>
let add = async () => {
let gymData = {
smallImg: document.querySelector("#smallImg").value,
title: document.querySelector("#title").value,
video: document.querySelector("#video").value,
Sort: document.querySelector("#Sort").value,
bigImg: document.querySelector("#bigImg").value,
muscleGroup: document.querySelector("#muscleGroup").value,
steps: document.querySelector("#steps").value,
tips: document.querySelector("#tips").value,
warning: document.querySelector("#warning").value,
};
gymData = JSON.stringify(gymData);
let response = await fetch("http://127.0.0.1:3000/api/cardio", {
method: "POST",
body: gymData,
headers: {
"Content-Type": "application/json",
},
});
let data = await response.json();
console.log(data);
};
document.querySelector("#btn").addEventListener("click", add);
let add1 = async () => {
let gymData = {
smallImg: document.querySelector("#smallImg1").value,
title: document.querySelector("#title1").value,
video: document.querySelector("#video1").value,
Sort: document.querySelector("#Sort1").value,
bigImg: document.querySelector("#bigImg1").value,
};
gymData = JSON.stringify(gymData);
let response = await fetch("http://127.0.0.1:3000/api/workout", {
method: "POST",
body: gymData,
headers: {
"Content-Type": "application/json",
},
});
let data = await response.json();
console.log(data);
};
document.querySelector("#btn1").addEventListener("click", add1);
</script>