mirror of
https://github.com/flarum/framework.git
synced 2025-05-21 14:22:33 +08:00
Implement basic settings page
This commit is contained in:
@ -155,7 +155,7 @@ export default class Model {
|
||||
|
||||
return app.request({
|
||||
method: this.exists ? 'PATCH' : 'POST',
|
||||
url: app.forum.attribute('apiUrl') + '/' + this.data.type + (this.exists ? '/' + this.data.id : ''),
|
||||
url: app.forum.attribute('apiUrl') + this.apiEndpoint(),
|
||||
data: {data}
|
||||
}).then(
|
||||
// If everything went well, we'll make sure the store knows that this
|
||||
@ -187,13 +187,23 @@ export default class Model {
|
||||
|
||||
return app.request({
|
||||
method: 'DELETE',
|
||||
url: app.forum.attribute('apiUrl') + '/' + this.data.type + '/' + this.data.id,
|
||||
url: app.forum.attribute('apiUrl') + this.apiEndpoint(),
|
||||
data
|
||||
}).then(
|
||||
() => this.exists = false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a path to the API endpoint for this resource.
|
||||
*
|
||||
* @return {String}
|
||||
* @protected
|
||||
*/
|
||||
apiEndpoint() {
|
||||
return '/' + this.data.type + (this.exists ? '/' + this.data.id : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a function which returns the value of the given attribute.
|
||||
*
|
||||
|
Reference in New Issue
Block a user