mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 06:06:15 +01:00
Improve GetUserBans error handling & remove useless delcaration in PostSession
This commit is contained in:
parent
3af4ee6c84
commit
d20b0029bb
2 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,8 @@ func (rt *_router) GetUserBans(w http.ResponseWriter, r *http.Request, ps httpro
|
|||
// Return ban list
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK) // is it needed?
|
||||
json.NewEncoder(w).Encode(bans)
|
||||
|
||||
err = json.NewEncoder(w).Encode(bans) // write the response
|
||||
|
||||
if err != nil {
|
||||
helpers.SendInternalError(err, "Error encoding json", w, rt.baseLogger)
|
||||
|
|
|
@ -30,7 +30,6 @@ func (rt *_router) PostSession(w http.ResponseWriter, r *http.Request, ps httpro
|
|||
uid, err = rt.db.GetUserID(request.Name)
|
||||
}
|
||||
if db_errors.EmptySet(err) { // user does not exist
|
||||
err = nil
|
||||
uid, err = rt.db.CreateUser(request.Name)
|
||||
}
|
||||
if err != nil { // handle any other error
|
||||
|
|
Loading…
Reference in a new issue