feat: redirect to expenses after add from overview
This commit is contained in:
parent
800a3298d9
commit
ccd6eaf9ee
2 changed files with 3 additions and 9 deletions
|
|
@ -566,14 +566,8 @@ func (h *SpaceHandler) CreateExpense(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.URL.Query().Get("from") == "overview" {
|
if r.URL.Query().Get("from") == "overview" {
|
||||||
ui.Render(w, r, toast.Toast(toast.Props{
|
w.Header().Set("HX-Redirect", "/app/spaces/"+spaceID+"/expenses")
|
||||||
Title: "Expense created",
|
w.WriteHeader(http.StatusOK)
|
||||||
Description: "Your transaction has been recorded.",
|
|
||||||
Variant: toast.VariantSuccess,
|
|
||||||
Icon: true,
|
|
||||||
Dismissible: true,
|
|
||||||
Duration: 5000,
|
|
||||||
}))
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ type AddExpenseFormProps struct {
|
||||||
Tags []*model.Tag
|
Tags []*model.Tag
|
||||||
ListsWithItems []model.ListWithUncheckedItems
|
ListsWithItems []model.ListWithUncheckedItems
|
||||||
DialogID string // which dialog to close on success
|
DialogID string // which dialog to close on success
|
||||||
FromOverview bool // if true, POSTs with ?from=overview for toast response
|
FromOverview bool // if true, POSTs with ?from=overview; server redirects to expenses page
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p AddExpenseFormProps) formAttrs() templ.Attributes {
|
func (p AddExpenseFormProps) formAttrs() templ.Attributes {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue