Skip to content

Commit 308d268

Browse files
fix: Fetch pages before findBy (#5876)
1 parent b5863f5 commit 308d268

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/routes/pages.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import classic from 'ember-classic-decorator';
22
import Route from '@ember/routing/route';
3+
import { inject as service } from '@ember/service';
34

45
@classic
56
export default class PagesRoute extends Route {
7+
8+
@service cache;
9+
610
// Enumerate possible page names for extraction for localization
711
pages() {
812
return [this.l10n.t('Terms'), this.l10n.t('Contact'), this.l10n.t('Refund Policy'), this.l10n.t('Privacy')];
@@ -12,8 +16,8 @@ export default class PagesRoute extends Route {
1216
return this.l10n.tVar(model?.name) || this.l10n.t('Pages');
1317
}
1418

15-
model(params) {
16-
return this.modelFor('application').pages.findBy('url', params.path);
19+
async model(params) {
20+
return (await this.cache.query('pages', 'page', { public: true })).toArray().findBy('url', params.path);
1721
}
1822

1923
renderTemplate(model) {

0 commit comments

Comments
 (0)