app/API build adjustments; get user from ctx

This commit is contained in:
Daniel J. Summers
2018-03-12 23:14:16 -05:00
parent b7406bd827
commit 8d84bdb2e6
4 changed files with 9 additions and 6 deletions

View File

@@ -33,7 +33,8 @@ func sendJSON(w http.ResponseWriter, r *http.Request, result interface{}) {
/* Handlers */
func journal(w http.ResponseWriter, r *http.Request, _ httprouter.Params, db *sql.DB) {
reqs := data.Journal(db, "TODO: get user ID")
user := r.Context().Value(ContextUserKey)
reqs := data.Journal(db, user.(string))
if reqs == nil {
reqs = []data.JournalRequest{}
}