forked from atmoner/cosmos-faucet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
claim.html
81 lines (73 loc) · 1.79 KB
/
claim.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
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box;}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type=submit] {
background-color: #04AA6D;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
.container {
margin-left:auto;
margin-right:auto;
width: 500px;
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
<body>
<div class="container" id="app">
<label for="fname">Your address</label>
<input v-model="address" type="text" placeholder="You address">
<input type="submit" value="Claim your faucet" @click="submitForm()">
<div >{{ message }}</div>
</div>
<script>
const { createApp, ref } = Vue
createApp({
setup() {
const message = ref('')
const address = ref('')
return {
message,
address
}
},
methods: {
submitForm() {
fetch('/faucet/claim/' + this.address)
.then(response => response.json())
.then(data => {
console.log(data)
this.message = data.result
})
.catch(error => {
console.error(error)
})
}
}
}).mount('#app')
</script>
</body>
</html>