fix session code

This commit is contained in:
root
2020-11-24 22:45:36 +00:00
parent 7a2d4c2033
commit a172e3569f

View File

@@ -53,14 +53,14 @@ func (e mainEnv) createSession(w http.ResponseWriter, r *http.Request, ps httpro
userTOKEN = userBson["token"].(string) userTOKEN = userBson["token"].(string)
event.Record = userTOKEN event.Record = userTOKEN
} }
session, err := e.db.createSessionRecord(session, userTOKEN, expiration, parsedData.jsonData) session, err = e.db.createSessionRecord(session, userTOKEN, expiration, parsedData.jsonData)
if err != nil { if err != nil {
returnError(w, r, "internal error", 405, err, event) returnError(w, r, "internal error", 405, err, event)
return return
} }
w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(200) w.WriteHeader(200)
fmt.Fprintf(w, `{"status":"ok","session":"%s"}`, sessionID) fmt.Fprintf(w, `{"status":"ok","session":"%s"}`, session)
return return
} }