Files
tueem e39821a3e2
build / Go-Build (push) Successful in 1m23s
build / Go-Build (pull_request) Successful in 1m23s
feat(svg): added svg template delete endpoint
2026-05-15 17:24:45 +02:00

27 lines
507 B
Go

package routes
import (
"net/http"
"tomatentum.net/svg-templater/pkg/svg/actions"
)
func DeleteSvg(writer http.ResponseWriter, reader *http.Request) {
id := reader.PathValue("id")
if id == "" {
http.Error(writer, "No ID provided", http.StatusBadRequest)
return
}
success, err := actions.Delete(id)
if err != nil {
http.Error(writer, err.Error(), http.StatusInternalServerError)
return
}
if !success {
http.Error(writer, "No template to delete.", http.StatusBadRequest)
return
}
}