Compare commits
No commits in common. "79496e8e492cf833964a00e07711aaad6435c319" and "6a4f578cfca698a81fb80730893844ee923e0b91" have entirely different histories.
79496e8e49
...
6a4f578cfc
4 changed files with 3 additions and 33 deletions
|
|
@ -10,5 +10,6 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/">Back</a>
|
<a href="/">Back</a>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="/rsvp_confirmed.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<!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>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
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 == fmt.Sprintf("Basic %s", token)
|
return auth == token
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
@ -86,18 +86,12 @@ 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)
|
||||||
|
|
||||||
|
|
@ -127,7 +121,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, 64)
|
partySize, err := strconv.ParseInt(r.Form.Get("party-size"), 10, 1)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue