25 lines
482 B
Go
25 lines
482 B
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"gitea.henriburau.de/haw-lan/cod4watcher/views/capture"
|
|
"github.com/go-chi/chi"
|
|
)
|
|
|
|
func (s *Server) HandleCapture(w http.ResponseWriter, r *http.Request) error {
|
|
captureString := chi.URLParam(r, "captureID")
|
|
captureID, err := strconv.Atoi(captureString)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
foundCapture, err := s.cs.GetCaptureById(captureID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return Render(w, r, capture.Capture(foundCapture))
|
|
}
|