ember-cli-todo-mvc icon indicating copy to clipboard operation
ember-cli-todo-mvc copied to clipboard

failed to delete todo

Open bossyang opened this issue 9 years ago • 4 comments

After click the delete button, I got an error in the console.

"Successful request: DELETE /todos/2" vendor.js:138701:0
Object {  } vendor.js:138702:12
"EmberError@http://localhost:4200/assets/vendor.js:25876:15
assert@http://localhost:4200/assets/vendor.js:15777:13
assert@http://localhost:4200/assets/vendor.js:23178:12
ember$data$lib$system$store$serializer$response$$normalizeResponseHelper@http://localhost:4200/assets/vendor.js:124726:1
ember$data$lib$system$store$$_commit/</<@http://localhost:4200/assets/vendor.js:130517:23
Backburner.prototype.run@http://localhost:4200/assets/vendor.js:10848:18
ember$data$lib$system$store$$Store<._adapterRun@http://localhost:4200/assets/vendor.js:130369:16
ember$data$lib$system$store$$_commit/<@http://localhost:4200/assets/vendor.js:130514:9
tryCatch@http://localhost:4200/assets/vendor.js:61860:14
invokeCallback@http://localhost:4200/assets/vendor.js:61875:15
publish@http://localhost:4200/assets/vendor.js:61843:9
@http://localhost:4200/assets/vendor.js:40493:7
Queue.prototype.invoke@http://localhost:4200/assets/vendor.js:11576:9
Queue.prototype.flush@http://localhost:4200/assets/vendor.js:11640:11
DeferredActionQueues.prototype.flush@http://localhost:4200/assets/vendor.js:11441:11
Backburner.prototype.end@http://localhost:4200/assets/vendor.js:10730:9
Backburner.prototype.run@http://localhost:4200/assets/vendor.js:10852:13
run@http://localhost:4200/assets/vendor.js:30215:12
ember$data$lib$adapters$rest$adapter$$RESTAdapter<.ajax/</hash.success@http://localhost:4200/assets/vendor.js:123113:15
jQuery.Callbacks/fire@http://localhost:4200/assets/vendor.js:3350:10
jQuery.Callbacks/self.fireWith@http://localhost:4200/assets/vendor.js:3462:7
done@http://localhost:4200/assets/vendor.js:9516:5
.send/callback@http://localhost:4200/assets/vendor.js:9920:8
_readyStateChange@http://localhost:4200/assets/vendor.js:65392:9
_setResponseBody@http://localhost:4200/assets/vendor.js:65458:9
respond@http://localhost:4200/assets/vendor.js:65479:7
handleRequest/<@http://localhost:4200/assets/vendor.js:66478:11
resolve@http://localhost:4200/assets/vendor.js:66515:9
handleResponse/<@http://localhost:4200/assets/vendor.js:66506:11
"

bossyang avatar Oct 28 '15 09:10 bossyang

+1

monchoz avatar Nov 23 '15 01:11 monchoz

You'll have to handle the DELETE request. Edit your config.js from mirage folder to this:

this.del('/todos/:id', function(db, request) {
    let id = request.params.id;
    db.todos.remove(id);
    return new Mirage.Response(204, {}, {});
});

monchoz avatar Nov 23 '15 03:11 monchoz

+1

leyuan avatar Jan 05 '16 22:01 leyuan

I downgraded mirage package in packages.json to 0.1.8... in fact most of my weird errors were coming from new version packages that my project installed. When I got code from this git - it all worked, but its using older packages that work together ok.

bpetar avatar Jan 20 '16 15:01 bpetar