feat(svg): added svg template delete endpoint
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user