Compare commits
2 commits
6a4f578cfc
...
79496e8e49
| Author | SHA1 | Date | |
|---|---|---|---|
| 79496e8e49 | |||
| 9c7c52a0de |
4 changed files with 33 additions and 3 deletions
|
|
@ -10,6 +10,5 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/">Back</a>
|
<a href="/">Back</a>
|
||||||
</div>
|
</div>
|
||||||
<script src="/rsvp_confirmed.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
12
client/rsvps_list.html
Normal file
12
client/rsvps_list.html
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="title fontXL textCenter backgroundLightGreen colorWhite">Collin and Lucy's Wedding</h1>
|
||||||
|
<div class="contents">
|
||||||
|
</div>
|
||||||
|
<script src="/rsvps_list.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
13
client/rsvps_list.js
Normal file
13
client/rsvps_list.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
function createRsvpEntry(rsvp) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getRsvps() {
|
||||||
|
// token is test:test for now
|
||||||
|
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': 'Basic dGVzdDp0ZXN0'} })
|
||||||
|
JSON.parse(resp.body)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = async function () {
|
||||||
|
await getRsvps();
|
||||||
|
};
|
||||||
|
|
@ -70,7 +70,7 @@ func isAuthorized(r *http.Request) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return auth == token
|
return auth == fmt.Sprintf("Basic %s", token)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
@ -86,12 +86,18 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
case r.Method == "GET" && r.URL.Path == "/rsvp_confirmed":
|
case r.Method == "GET" && r.URL.Path == "/rsvp_confirmed":
|
||||||
getStaticFile("./client/rsvp_confirmed.html", "text/html", w)
|
getStaticFile("./client/rsvp_confirmed.html", "text/html", w)
|
||||||
|
|
||||||
|
case r.Method == "GET" && r.URL.Path == "/rsvps_list":
|
||||||
|
getStaticFile("./client/rsvps_list.html", "text/html", w)
|
||||||
|
|
||||||
case r.Method == "GET" && r.URL.Path == "/index.js":
|
case r.Method == "GET" && r.URL.Path == "/index.js":
|
||||||
getStaticFile("./client/index.js", "text/javascript", w)
|
getStaticFile("./client/index.js", "text/javascript", w)
|
||||||
|
|
||||||
case r.Method == "GET" && r.URL.Path == "/rsvp.js":
|
case r.Method == "GET" && r.URL.Path == "/rsvp.js":
|
||||||
getStaticFile("./client/rsvp.js", "text/javascript", w)
|
getStaticFile("./client/rsvp.js", "text/javascript", w)
|
||||||
|
|
||||||
|
case r.Method == "GET" && r.URL.Path == "/rsvps_list.js":
|
||||||
|
getStaticFile("./client/rsvps_list.js", "text/javascript", w)
|
||||||
|
|
||||||
case r.Method == "GET" && r.URL.Path == "/style.css":
|
case r.Method == "GET" && r.URL.Path == "/style.css":
|
||||||
getStaticFile("./client/style.css", "text/css", w)
|
getStaticFile("./client/style.css", "text/css", w)
|
||||||
|
|
||||||
|
|
@ -121,7 +127,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
attending := r.Form.Get("attending") == "true"
|
attending := r.Form.Get("attending") == "true"
|
||||||
partySize, err := strconv.ParseInt(r.Form.Get("party-size"), 10, 1)
|
partySize, err := strconv.ParseInt(r.Form.Get("party-size"), 10, 64)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue