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 3486fe6 commit 1cf5e0fCopy full SHA for 1cf5e0f
app/routes/category.js
@@ -4,12 +4,14 @@ import { inject as service } from '@ember/service';
4
export default Route.extend({
5
flashMessages: service(),
6
7
- model(params) {
8
- return this.store.find('category', params.category_id).catch(e => {
+ async model(params) {
+ try {
9
+ return await this.store.find('category', params.category_id);
10
+ } catch (e) {
11
if (e.errors.some(e => e.detail === 'Not Found')) {
12
this.flashMessages.queue(`Category '${params.category_id}' does not exist`);
13
return this.replaceWith('index');
14
}
- });
15
+ }
16
},
17
});
0 commit comments