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 { 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 { return errors.New("not impl") } 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") } func (a *Ajax) renameList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) deleteList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) setSort(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) publishList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) changeListOrder(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) clearCompletedInList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) setShowNotesInList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") } func (a *Ajax) setHideList(w http.ResponseWriter, r *http.Request) error { return errors.New("not impl") }