1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 14:37:49 +02:00

Better handling of API server errors

This commit is contained in:
Toby Zerner
2015-05-26 11:43:20 +09:30
parent feb4676aa0
commit 5fc2f3aeee
5 changed files with 31 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ export default class Model {
this.pushData(data);
return m.request({
return app.request({
method: this.exists ? 'PUT' : 'POST',
url: app.config['api_url']+'/'+this.data().type+(this.exists ? '/'+this.data().id : ''),
data: {data},
@@ -51,7 +51,7 @@ export default class Model {
delete() {
if (!this.exists) { return; }
return m.request({
return app.request({
method: 'DELETE',
url: app.config['api_url']+'/'+this.data().type+'/'+this.data().id,
background: true,