sprechstunden-go/controllers/confirmRequestHandler.go

23 lines
459 B
Go

package controllers
import (
"net/http"
)
func (b *BaseHandler) ConfirmRequestHandler(w http.ResponseWriter, req *http.Request) {
secret := req.FormValue("code")
request, err := b.requestRepo.FindBySecret(secret)
if err != nil {
b.serveTemplate(w, "requestNotFound", nil)
return
}
err = b.requestRepo.Execute(request)
if err != nil {
b.serveTemplate(w, "executeFailure", err.Error())
return
}
b.serveTemplate(w, "executeSuccess", nil)
}