Browse Source

updated button handling that broke with the button display update

cli-archive
nic 1 year ago
parent
commit
eaad2b0012
  1. 6
      internal/handlers/web/invoices.go

6
internal/handlers/web/invoices.go

@ -170,7 +170,10 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
invoiceID := parts[len(parts)-1] invoiceID := parts[len(parts)-1]
status := parts[len(parts)-2] statusPart := parts[len(parts)-2]
// Extract the status from the statusPart
status := strings.TrimSuffix(statusPart, "-invoice")
if invoiceID == "" { if invoiceID == "" {
http.Error(w, "Invalid invoice ID", http.StatusBadRequest) http.Error(w, "Invalid invoice ID", http.StatusBadRequest)
@ -179,6 +182,7 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) {
// Validate the status // Validate the status
validStatuses := map[string]bool{ validStatuses := map[string]bool{
"draft": true,
"fail": true, "fail": true,
"ok": true, "ok": true,
"pending": true, "pending": true,

Loading…
Cancel
Save