diff options
author | syn <isaqtm@gmail.com> | 2021-03-16 22:43:55 +0300 |
---|---|---|
committer | syn <isaqtm@gmail.com> | 2021-03-16 22:43:55 +0300 |
commit | 63acad675f5a4e2720b1756ed4e79995b05941f4 (patch) | |
tree | 74fc53803be1feff72e19d4261c936c95f1542da | |
parent | 600d06c9ab68ff968d36d92e5b37755069c3b355 (diff) | |
download | upnet-63acad675f5a4e2720b1756ed4e79995b05941f4.tar.gz |
-rw-r--r-- | back/app.py | 6 | ||||
-rw-r--r-- | front/index.jsx | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/back/app.py b/back/app.py index 7aa4607..9fbcb81 100644 --- a/back/app.py +++ b/back/app.py @@ -81,7 +81,7 @@ async def close_redis(app, loop): await app.db.wait_closed() -@app.post("/new-todo") +@app.post("/api/new-todo") async def new_todo(req): todo = Todo.unmarshal_safe(req.json) id = await req.app.db.incr("upnet_todo_id_seq") @@ -90,14 +90,14 @@ async def new_todo(req): return response_json(dict(status="ok", id=id)) -@app.post("/delete-todo") +@app.post("/api/delete-todo") async def delete_todo(req): id = req.json["id"] await req.app.db.delete(f"upnet:todo:{id}") return response_json(dict(status="ok", was=id)) -@app.get("/todos") +@app.get("/api/todos") async def get_todos(req): all_todos_keys = await req.app.db.keys("upnet:todo:*") diff --git a/front/index.jsx b/front/index.jsx index 85b1977..9e6670d 100644 --- a/front/index.jsx +++ b/front/index.jsx @@ -38,7 +38,7 @@ class TodoList extends Component { } componentWillMount() { - get("/todos").then(resp => { + get("/api/todos").then(resp => { let todos = resp.data.todos; todos.sort((todo1, todo2) => { return todo1.expires - todo2.expires; }) this.setState({ todos: resp.data.todos }) @@ -79,7 +79,7 @@ class TodoRow extends Component { } deleteTodo(event) { - post("/delete-todo", { id: this.state.id }) + post("/api/delete-todo", { id: this.state.id }) .then(resp => { console.log(resp); window.location.reload(); @@ -113,7 +113,7 @@ class PostForm extends Component { return; } post( - "/new-todo", { + "/api/new-todo", { desc: this.state.desc, expires: new Date(this.state.date).getTime(), done: false |