-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathindex.html
55 lines (54 loc) · 1.71 KB
/
index.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
<!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" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Open+Sans"
/>
<style>
body {
font-family: "Open Sans", sans-serif;
margin: 5%;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://unpkg.com/[email protected]/dist/vue-silentbox.min.js"></script>
<title>Pick.le: Pick your pics 🥒</title>
</head>
<body>
<div id="app">
<h1>Pick.le: Pick your pics 🥒</h1>
<h2>{{ callToAction }}</h2>
<silent-box :gallery="gallery"></silent-box>
</div>
<script>
Vue.use(VueSilentbox.default);
const app = new Vue({
el: "#app",
data() {
return {
callToAction: "Submit your photos of burritos!",
gallery: [],
};
},
methods: {
async loadImages() {
// Our API is on the same server so we don't need to specify the host
// NOTE: fetch is asynchronous and returns a `Promise`, so we'll `await`
const response = await fetch("/api/pics");
// NOTE: The `json` method on the response object is also asynchronous
// Setting the gallery object automatically causes the API to refresh because
// we bound it to the plugin as part of the `data` API of Vue.
this.gallery = await response.json();
},
},
mounted() {
this.loadImages();
},
});
</script>
</body>
</html>