Add Config model

* Add ability to configurably cache API responses per model
* Fix general error display on credentials
* Add current version from API to the documentation link
This commit is contained in:
gconsidine
2017-07-31 17:07:25 -04:00
parent 59157565bd
commit bdb2bbbd41
9 changed files with 171 additions and 24 deletions

View File

@@ -0,0 +1,32 @@
let BaseModel;
function getTruncatedVersion () {
let version;
try {
version = this.get('version').split('-')[0];
} catch (err) {
console.error(err);
}
return version;
}
function ConfigModel (method, resource, graft) {
BaseModel.call(this, 'config', { cache: true });
this.Constructor = ConfigModel;
this.getTruncatedVersion = getTruncatedVersion;
return this.create(method, resource, graft);
}
function ConfigModelLoader (_BaseModel_) {
BaseModel = _BaseModel_;
return ConfigModel;
}
ConfigModelLoader.$inject = ['BaseModel'];
export default ConfigModelLoader;