We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
model()
1 parent 1cf5e0f commit 72268b8Copy full SHA for 72268b8
app/routes/keyword.js
@@ -4,12 +4,14 @@ import { inject as service } from '@ember/service';
4
export default Route.extend({
5
flashMessages: service(),
6
7
- model({ keyword_id }) {
8
- return this.store.find('keyword', keyword_id).catch(e => {
+ async model({ keyword_id }) {
+ try {
9
+ return await this.store.find('keyword', keyword_id);
10
+ } catch (e) {
11
if (e.errors.some(e => e.detail === 'Not Found')) {
12
this.flashMessages.queue(`Keyword '${keyword_id}' does not exist`);
13
return this.replaceWith('index');
14
}
- });
15
+ }
16
},
17
});
0 commit comments