diff --git a/app/routes/category.js b/app/routes/category.js index bd106c48fb9..f60983e8151 100644 --- a/app/routes/category.js +++ b/app/routes/category.js @@ -4,12 +4,14 @@ import { inject as service } from '@ember/service'; export default Route.extend({ flashMessages: service(), - model(params) { - return this.store.find('category', params.category_id).catch(e => { + async model(params) { + try { + return await this.store.find('category', params.category_id); + } catch (e) { if (e.errors.some(e => e.detail === 'Not Found')) { this.flashMessages.queue(`Category '${params.category_id}' does not exist`); return this.replaceWith('index'); } - }); + } }, }); diff --git a/app/routes/keyword.js b/app/routes/keyword.js index cc5dfa1dba0..7c597d00a41 100644 --- a/app/routes/keyword.js +++ b/app/routes/keyword.js @@ -4,12 +4,14 @@ import { inject as service } from '@ember/service'; export default Route.extend({ flashMessages: service(), - model({ keyword_id }) { - return this.store.find('keyword', keyword_id).catch(e => { + async model({ keyword_id }) { + try { + return await this.store.find('keyword', keyword_id); + } catch (e) { if (e.errors.some(e => e.detail === 'Not Found')) { this.flashMessages.queue(`Keyword '${keyword_id}' does not exist`); return this.replaceWith('index'); } - }); + } }, });