-
Notifications
You must be signed in to change notification settings - Fork 9
/
admin.html
77 lines (68 loc) · 1.95 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Paywall Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
// const baseURL = 'http://192.168.0.157:3000/'
const baseURL = 'http://127.0.0.1:3000'
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/qrcode.min.js"></script>
<style>
.container {
border: 1px solid red;
height: 100vh;
width: 100vw;
}
.product_wrap {
display: flex;
flex-direction: column;
width: 20%;
}
input {
margin-bottom: 15px;
padding: 15px;
}
button {
padding: 15px;
}
</style>
</head>
<body>
<main class="container">
<h1>Hey Admin</h1>
<h2>Add Product</h2>
<aside class="product_wrap">
<input id="desc" placeholder="Payment description" />
<input id="img" placeholder="Image URI" />
<input id="amount" placeholder="Amount" />
<button onclick="createProduct()">Add Product</button>
</aside>
</main>
<script>
function createProduct() {
let desc = $("#desc").val();
let amount = $("#amount").val();
let img = $("#img").val();
let requestBody = {
description: desc,
amount: amount,
img_url: img
};
console.log('creating product requestbody ', requestBody)
jQuery.ajax({
type: "POST",
// url: `${baseURL}/add-product`,
url: `${baseURL}/collection`,
data: requestBody,
dataType: 'json'
}).done(function(data) {
console.log('returned data ', data)
$("input").val("")
})
}
</script>
</body>
</html>