mirror of
https://github.com/andatoshiki/shikigrid.git
synced 2026-06-05 19:56:27 +00:00
18 lines
396 B
Go
18 lines
396 B
Go
package api
|
|
|
|
import (
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/andatoshiki/shikigrid/models"
|
|
"net/http"
|
|
)
|
|
|
|
func (api *API) ShowUnit(w http.ResponseWriter, r *http.Request) {
|
|
unitFingerprint := chi.URLParam(r, "fingerprint")
|
|
if unit := models.FindUnitByFingerprint(unitFingerprint); unit == nil {
|
|
ERROR(w, http.StatusNotFound, ErrEmpty)
|
|
return
|
|
} else {
|
|
JSON(w, http.StatusOK, unit)
|
|
}
|
|
}
|