Rework addTime
This commit is contained in:
6
timer.go
6
timer.go
@ -363,7 +363,7 @@ func (server *MyServer) handleTimerAddTime(w http.ResponseWriter, r *http.Reques
|
||||
return
|
||||
}
|
||||
|
||||
duration, err := parseDuration(r.PathValue("timeToAdd"))
|
||||
duration, err := parseDuration(r.FormValue("timeToAdd"))
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.Write([]byte(err.Error()))
|
||||
@ -377,7 +377,7 @@ func (server *MyServer) handleTimerAddTime(w http.ResponseWriter, r *http.Reques
|
||||
return
|
||||
}
|
||||
|
||||
view.TimerView(*timer).Render(context.Background(), w)
|
||||
view.TimerInfo(*timer).Render(context.Background(), w)
|
||||
}
|
||||
|
||||
func (server *MyServer) handleGetTimerToken(w http.ResponseWriter, r *http.Request) {
|
||||
@ -559,7 +559,7 @@ func main() {
|
||||
http.HandleFunc("POST /login", myServer.handlePostLogin)
|
||||
http.HandleFunc("POST /logout", myServer.handlePostLogout)
|
||||
http.HandleFunc("GET /timer/{timerId}", myServer.handleTimer)
|
||||
http.HandleFunc("POST /timer/{timerId}/addTime/{timeToAdd}", myServer.handleTimerAddTime)
|
||||
http.HandleFunc("POST /timer/{timerId}/addTime", myServer.handleTimerAddTime)
|
||||
http.HandleFunc("DELETE /timer/{timerId}", myServer.handleDeleteTimer)
|
||||
http.HandleFunc("POST /timer/{timerId}/resetToken", myServer.handleResetTimerToken)
|
||||
http.HandleFunc("GET /timer/{timerId}/token", myServer.handleGetTimerToken)
|
||||
|
Reference in New Issue
Block a user