File tree Expand file tree Collapse file tree 12 files changed +28
-13
lines changed Expand file tree Collapse file tree 12 files changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
4
4
5
5
export default class CategoryRoute extends Route {
6
6
@service notifications ;
7
+ @service router ;
7
8
@service store ;
8
9
9
10
async model ( params ) {
@@ -12,7 +13,7 @@ export default class CategoryRoute extends Route {
12
13
} catch ( error ) {
13
14
if ( error instanceof NotFoundError ) {
14
15
this . notifications . error ( `Category '${ params . category_id } ' does not exist` ) ;
15
- return this . replaceWith ( 'index' ) ;
16
+ return this . router . replaceWith ( 'index' ) ;
16
17
}
17
18
18
19
throw error ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ajax from '../utils/ajax';
5
5
6
6
export default class ConfirmRoute extends Route {
7
7
@service notifications ;
8
+ @service router ;
8
9
@service session ;
9
10
@service store ;
10
11
@@ -29,6 +30,6 @@ export default class ConfirmRoute extends Route {
29
30
}
30
31
}
31
32
32
- this . replaceWith ( 'index' ) ;
33
+ this . router . replaceWith ( 'index' ) ;
33
34
}
34
35
}
Original file line number Diff line number Diff line change 1
1
import Route from '@ember/routing/route' ;
2
+ import { inject as service } from '@ember/service' ;
2
3
3
4
export default class VersionRoute extends Route {
5
+ @service router ;
6
+
4
7
async model ( ) {
5
8
let crate = this . modelFor ( 'crate' ) ;
6
9
let versions = await crate . get ( 'versions' ) ;
7
10
8
11
let { defaultVersion } = crate ;
9
12
let version = versions . find ( version => version . num === defaultVersion ) ?? versions . lastObject ;
10
13
11
- this . replaceWith ( 'crate.version-dependencies' , crate , version . num ) ;
14
+ this . router . replaceWith ( 'crate.version-dependencies' , crate , version . num ) ;
12
15
}
13
16
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
4
4
export default class CrateDocsRoute extends Route {
5
5
@service notifications ;
6
6
@service redirector ;
7
+ @service router ;
7
8
8
9
redirect ( ) {
9
10
let crate = this . modelFor ( 'crate' ) ;
@@ -16,7 +17,7 @@ export default class CrateDocsRoute extends Route {
16
17
// no documentation is found
17
18
let message = 'Crate does not supply a documentation URL' ;
18
19
this . notifications . error ( message ) ;
19
- this . replaceWith ( 'crate' , crate ) ;
20
+ this . router . replaceWith ( 'crate' , crate ) ;
20
21
}
21
22
}
22
23
}
Original file line number Diff line number Diff line change 1
1
import Route from '@ember/routing/route' ;
2
+ import { inject as service } from '@ember/service' ;
2
3
3
4
export default class OwnersRoute extends Route {
5
+ @service router ;
6
+
4
7
redirect ( ) {
5
8
let crate = this . modelFor ( 'crate' ) ;
6
9
7
- this . transitionTo ( 'crate.settings' , crate ) ;
10
+ this . router . transitionTo ( 'crate.settings' , crate ) ;
8
11
}
9
12
}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default class VersionRoute extends Route {
23
23
let versionNum = maxSatisfying ( unyankedVersionNums , npmRange ) ?? maxSatisfying ( allVersionNums , npmRange ) ;
24
24
if ( ! versionNum ) {
25
25
this . notifications . error ( `No matching version of crate '${ crate . name } ' found for: ${ range } ` ) ;
26
- this . replaceWith ( 'crate.index' ) ;
26
+ this . router . replaceWith ( 'crate.index' ) ;
27
27
}
28
28
29
29
this . router . replaceWith ( 'crate.version' , versionNum ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
4
4
export default class RepoRoute extends Route {
5
5
@service notifications ;
6
6
@service redirector ;
7
+ @service router ;
7
8
8
9
redirect ( ) {
9
10
let crate = this . modelFor ( 'crate' ) ;
@@ -16,7 +17,7 @@ export default class RepoRoute extends Route {
16
17
// no repository is found
17
18
let message = 'Crate does not supply a repository URL' ;
18
19
this . notifications . error ( message ) ;
19
- this . replaceWith ( 'crate' , crate ) ;
20
+ this . router . replaceWith ( 'crate' , crate ) ;
20
21
}
21
22
}
22
23
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
3
3
4
4
export default class ReverseDependenciesRoute extends Route {
5
5
@service notifications ;
6
+ @service router ;
6
7
@service store ;
7
8
8
9
queryParams = {
@@ -25,7 +26,7 @@ export default class ReverseDependenciesRoute extends Route {
25
26
}
26
27
27
28
this . notifications . error ( message ) ;
28
- this . replaceWith ( 'index' ) ;
29
+ this . router . replaceWith ( 'index' ) ;
29
30
}
30
31
}
31
32
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
3
3
4
4
export default class VersionRoute extends Route {
5
5
@service notifications ;
6
+ @service router ;
6
7
7
8
async model ( params ) {
8
9
let crate = this . modelFor ( 'crate' ) ;
@@ -12,7 +13,7 @@ export default class VersionRoute extends Route {
12
13
let version = versions . find ( version => version . num === requestedVersion ) ;
13
14
if ( ! version ) {
14
15
this . notifications . error ( `Version '${ requestedVersion } ' of crate '${ crate . name } ' does not exist` ) ;
15
- this . replaceWith ( 'crate.index' ) ;
16
+ this . router . replaceWith ( 'crate.index' ) ;
16
17
}
17
18
18
19
try {
@@ -21,7 +22,7 @@ export default class VersionRoute extends Route {
21
22
this . notifications . error (
22
23
`Failed to load the list of dependencies for the '${ crate . name } ' crate. Please try again later!` ,
23
24
) ;
24
- this . replaceWith ( 'crate.index' ) ;
25
+ this . router . replaceWith ( 'crate.index' ) ;
25
26
}
26
27
27
28
return version ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
4
4
5
5
export default class KeywordRoute extends Route {
6
6
@service notifications ;
7
+ @service router ;
7
8
@service store ;
8
9
9
10
async model ( { keyword_id } ) {
@@ -12,7 +13,7 @@ export default class KeywordRoute extends Route {
12
13
} catch ( error ) {
13
14
if ( error instanceof NotFoundError ) {
14
15
this . notifications . error ( `Keyword '${ keyword_id } ' does not exist` ) ;
15
- return this . replaceWith ( 'index' ) ;
16
+ return this . router . replaceWith ( 'index' ) ;
16
17
}
17
18
18
19
throw error ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
3
3
4
4
export default class TeamRoute extends Route {
5
5
@service notifications ;
6
+ @service router ;
6
7
@service store ;
7
8
8
9
queryParams = {
@@ -24,7 +25,7 @@ export default class TeamRoute extends Route {
24
25
} catch ( error ) {
25
26
if ( error . errors ?. some ( e => e . detail === 'Not Found' ) ) {
26
27
this . notifications . error ( `Team '${ params . team_id } ' does not exist` ) ;
27
- return this . replaceWith ( 'index' ) ;
28
+ return this . router . replaceWith ( 'index' ) ;
28
29
}
29
30
30
31
throw error ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
3
3
4
4
export default class UserRoute extends Route {
5
5
@service notifications ;
6
+ @service router ;
6
7
@service store ;
7
8
8
9
queryParams = {
@@ -23,7 +24,7 @@ export default class UserRoute extends Route {
23
24
} catch ( error ) {
24
25
if ( error . errors ?. some ( e => e . detail === 'Not Found' ) ) {
25
26
this . notifications . error ( `User '${ params . user_id } ' does not exist` ) ;
26
- return this . replaceWith ( 'index' ) ;
27
+ return this . router . replaceWith ( 'index' ) ;
27
28
}
28
29
29
30
throw error ;
You can’t perform that action at this time.
0 commit comments