Skip to content

Commit 215ca9e

Browse files
committed
Use ember-data/store instead of @ember-data/store in the code examples
1 parent e325d5c commit 215ca9e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

snippets/adapters/cache-lifetime/new.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { LifetimesService } from '@ember-data/request-utils';
2-
import DataStore from '@ember-data/store';
2+
import BaseStore from 'ember-data/store';
33

4-
export default class Store extends DataStore {
4+
export default class Store extends BaseStore {
55
constructor(args) {
66
super(args);
77
// This is default configuration that would be set automatically be Ember Data
8-
// this.lifetimes = new LifetimesService(this, {
9-
// apiCacheSoftExpires: 30_000,
10-
// apiCacheHardExpires: 60_000
11-
// });
8+
this.lifetimes = new LifetimesService(this, {
9+
apiCacheSoftExpires: 30_000,
10+
apiCacheHardExpires: 60_000
11+
});
12+
// Or you can overwrite it with your own logic
1213
this.lifetimes = {
1314
isHardExpired(identifier) {
1415
const cached = this.store.cache.peekRequest(identifier);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Replicate old on store methods
22
import { findRecord } from '@ember-data/json-api/request';
3-
import DataStore from '@ember-data/store'
3+
import BaseStore from 'ember-data/store'
44

5-
export default class Store extends DataStore {
5+
export default class Store extends BaseStore {
66
async findRecord(typeOrIdentifier, id, options) {
77
const result = await this.request(findRecord(typeOrIdentifier, id, options));
88
// but you might want to return whole result object, as it has meta, errors, links, etc.
@@ -11,4 +11,4 @@ export default class Store extends DataStore {
1111
}
1212

1313
// Somewhere in app
14-
const user = await this.store.findRecord('user', '1')
14+
const user = await store.findRecord('user', '1')

0 commit comments

Comments
 (0)