CHANGE: added api endpoint for time path
This commit is contained in:
@@ -75,6 +75,12 @@ func getBookings(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if r.Header.Get("Accept") == "application/json" {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
json.NewEncoder(w).Encode(bookings)
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx := context.WithValue(r.Context(), "user", user)
|
ctx := context.WithValue(r.Context(), "user", user)
|
||||||
templates.TimePage(bookings).Render(ctx, w)
|
templates.TimePage(bookings).Render(ctx, w)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user