Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
app-todo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Geovanny E. Vera Pazmino
app-todo
Commits
4ab45a07
Commit
4ab45a07
authored
Apr 10, 2020
by
Milan Iliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Server deletes
parent
36e83d84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
main.js
server/main.js
+9
-0
controller.js
web/tasks/controller.js
+7
-0
No files found.
server/main.js
View file @
4ab45a07
...
...
@@ -25,6 +25,15 @@ router.put("/tasks/:id", async (context) => {
})
router
.
delete
(
"/tasks/:id"
,
async
(
context
)
=>
{
let
task_id
=
context
.
request
.
params
[
"id"
]
let
task
=
tasks
.
find
((
task
)
=>
task
.
id
===
task_id
)
tasks
.
remove
(
task
)
context
.
response
.
status
=
204
})
const
app
=
new
Koa
()
app
.
use
(
serve
(
`
${
__dirname
}
/../web`
))
app
.
use
(
logger
())
...
...
web/tasks/controller.js
View file @
4ab45a07
...
...
@@ -22,6 +22,7 @@ class TaskController {
remoteTask
(
task
){
this
.
tasks
.
remove
(
task
)
this
.
view
.
removeTaskView
(
task
)
this
.
requestDelete
(
task
)
}
async
refresh
(){
...
...
@@ -41,6 +42,12 @@ class TaskController {
}
})
}
async
requestDelete
(
task
){
let
tasks_response
=
await
fetch
(
`/tasks/
${
task
.
id
}
`
,
{
method
:
"DELETE"
})
}
}
export
default
TaskController
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment