summaryrefslogtreecommitdiff
path: root/internal/handlers/widget.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/widget.go')
-rw-r--r--internal/handlers/widget.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/handlers/widget.go b/internal/handlers/widget.go
index 5880314..a2a0837 100644
--- a/internal/handlers/widget.go
+++ b/internal/handlers/widget.go
@@ -430,7 +430,13 @@ func (h *Handler) HandleWidgetComplete(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
-// HandleWidgetAdd creates a new undated native task from the widget's quick-add sheet.
+type widgetAddResponse struct {
+ ID string `json:"id"`
+}
+
+// HandleWidgetAdd creates a new undated native task from the widget's quick-add
+// sheet and returns its id, so the client can follow up with the same
+// project/labels/recurrence/due-date setter calls the edit popup uses.
func (h *Handler) HandleWidgetAdd(w http.ResponseWriter, r *http.Request) {
var req widgetAddRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -454,7 +460,8 @@ func (h *Handler) HandleWidgetAdd(w http.ResponseWriter, r *http.Request) {
return
}
- w.WriteHeader(http.StatusOK)
+ w.Header().Set("Content-Type", "application/json")
+ _ = json.NewEncoder(w).Encode(widgetAddResponse{ID: task.ID})
}
type recurrenceResponse struct {