User information

This commit is contained in:
Aurélie Delhaie
2022-05-25 13:11:06 +02:00
parent 87957cb2d5
commit d0ee7df3f5
3 changed files with 22 additions and 1 deletions

View File

@@ -221,3 +221,19 @@ func Download(w http.ResponseWriter, r *http.Request) {
http.NotFound(w, r)
}
}
func UserInformation(w http.ResponseWriter, r *http.Request) {
userId, err := userIdFromContext(r.Context())
if err != nil {
internalServerError(w, r)
log.Println(err)
return
}
user, err := database.UserById(userId)
if err != nil {
internalServerError(w, r)
log.Println(err)
return
}
ok(user, w, r)
}