File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ import { inject as service } from '@ember/service';
4
4
export default Route . extend ( {
5
5
flashMessages : service ( ) ,
6
6
7
- model ( params ) {
8
- return this . store . find ( 'category' , params . category_id ) . catch ( e => {
7
+ async model ( params ) {
8
+ try {
9
+ return await this . store . find ( 'category' , params . category_id ) ;
10
+ } catch ( e ) {
9
11
if ( e . errors . some ( e => e . detail === 'Not Found' ) ) {
10
12
this . flashMessages . queue ( `Category '${ params . category_id } ' does not exist` ) ;
11
13
return this . replaceWith ( 'index' ) ;
12
14
}
13
- } ) ;
15
+ }
14
16
} ,
15
17
} ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ import { inject as service } from '@ember/service';
4
4
export default Route . extend ( {
5
5
flashMessages : service ( ) ,
6
6
7
- model ( { keyword_id } ) {
8
- return this . store . find ( 'keyword' , keyword_id ) . catch ( e => {
7
+ async model ( { keyword_id } ) {
8
+ try {
9
+ return await this . store . find ( 'keyword' , keyword_id ) ;
10
+ } catch ( e ) {
9
11
if ( e . errors . some ( e => e . detail === 'Not Found' ) ) {
10
12
this . flashMessages . queue ( `Keyword '${ keyword_id } ' does not exist` ) ;
11
13
return this . replaceWith ( 'index' ) ;
12
14
}
13
- } ) ;
15
+ }
14
16
} ,
15
17
} ) ;
You can’t perform that action at this time.
0 commit comments