Implement basic settings page

This commit is contained in:
Toby Zerner
2015-07-29 21:00:09 +09:30
parent d71d8f59c2
commit f96cac6057
13 changed files with 313 additions and 17 deletions

View File

@ -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.
*