feat: 🎸 Add setup for api handlers

This commit is contained in:
Zhihe Li committed 2024-01-16 10:17:45 -05:00
1 parent 9bbd914a3a
commit 7dbd581a37
7 files changed
+35 -2

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import Store, { CacheHandler } from '@ember-data/store';
import RequestManager from '@ember-data/request';
import { LegacyNetworkHandler } from '@ember-data/legacy-compat';
export default class extends Store {
requestManager = new RequestManager();
constructor(args) {
super(args);
this.requestManager.use([LegacyNetworkHandler]);
this.requestManager.useCache(CacheHandler);
}
}
+1
View File
@@ -0,0 +1 @@
export { default } from 'api/services/store';
+1
View File
@@ -23,6 +23,7 @@
"doc:toc": "doctoc README.md"
},
"dependencies": {
"ember-auto-import": "^2.6.3",
"ember-can": "^4.2.0",
"ember-cli-babel": "^7.26.10",
"ember-cli-htmlbars": "^6.2.0",
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'dummy/tests/helpers';
module('Unit | Service | store', function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:store');
assert.ok(service);
});
});
+4
View File
@@ -33,6 +33,10 @@ module.exports = function (defaults) {
},
},
},
// TODO: Update to 4.12 when deprecations are resolved
emberData: {
compatWith: '4.4',
},
});
// Only import when in development or test mode
+1 -1
View File
@@ -35,7 +35,7 @@ export default class ApplicationRoute extends Route {
await this.session.setup();
const theme = this.session.get('data.theme');
this.toggleTheme(theme);
return this.clusterUrl.updateClusterUrl();
await this.clusterUrl.updateClusterUrl();
}
/**
@@ -18,8 +18,9 @@ export default class ScopesScopeAuthenticateRoute extends Route {
// =methods
beforeModel() {
if (this.session.isAuthenticated)
if (this.session.isAuthenticated) {
this.router.replaceWith('scopes.scope.index');
}
}
/**