Submit a task

This commit is contained in:
Bel LaPointe
2019-11-13 13:17:56 -07:00
parent ee77d9d3b7
commit cf1fd1dfed
13 changed files with 259 additions and 49 deletions

View File

@@ -1,14 +1,32 @@
package ajax
import (
"encoding/json"
"errors"
"local/todo-server/server/ajax/list"
"net/http"
)
type List struct{}
func (a *Ajax) loadLists(w http.ResponseWriter, r *http.Request) error {
return errors.New("not impl")
lists, err := a.storageListLists()
if err != nil {
return err
}
// TODO
lists = append(lists, &list.List{
ID: "Todo",
UUID: "Todo",
})
if err := a.storageSetList(lists[0].ID, lists[0]); err != nil {
return err
}
// /TODO
return json.NewEncoder(w).Encode(map[string]interface{}{
"total": len(lists),
"list": lists,
})
}
func (a *Ajax) changeOrder(w http.ResponseWriter, r *http.Request) error {
@@ -16,6 +34,7 @@ func (a *Ajax) changeOrder(w http.ResponseWriter, r *http.Request) error {
}
func (a *Ajax) addList(w http.ResponseWriter, r *http.Request) error {
// {"total":1,"list":[{"id":"21","name":"abc","sort":0,"published":0,"showCompl":0,"showNotes":0,"hidden":0}]}
return errors.New("not impl")
}