client/hippo/models/tenant.js in hippo-fw-0.9.6 vs client/hippo/models/tenant.js in hippo-fw-0.9.7
- old
+ new
@@ -2,21 +2,22 @@
import {
BaseModel, identifiedBy, field, identifier, computed,
} from './base';
import Config from '../config';
-const CACHE = observable({
- Tenant: undefined,
-});
+const CACHED = observable.box();
+
@identifiedBy('hippo/tenant')
export default class Tenant extends BaseModel {
@computed static get current() {
- if (!CACHE.Tenant) {
- CACHE.Tenant = new Tenant();
- CACHE.Tenant.fetch({ query: 'current' });
+ let tenant = CACHED.get();
+ if (!tenant) {
+ tenant = new Tenant();
+ CACHED.set(tenant);
+ tenant.fetch({ query: 'current' });
}
- return CACHE.Tenant;
+ return tenant;
}
@identifier id;
@field slug = Tenant.slug;
@field name;