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';
44
55export default class CategoryRoute extends Route {
66 @service notifications ;
7+ @service router ;
78 @service store ;
89
910 async model ( params ) {
@@ -12,7 +13,7 @@ export default class CategoryRoute extends Route {
1213 } catch ( error ) {
1314 if ( error instanceof NotFoundError ) {
1415 this . notifications . error ( `Category '${ params . category_id } ' does not exist` ) ;
15- return this . replaceWith ( 'index' ) ;
16+ return this . router . replaceWith ( 'index' ) ;
1617 }
1718
1819 throw error ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ajax from '../utils/ajax';
55
66export default class ConfirmRoute extends Route {
77 @service notifications ;
8+ @service router ;
89 @service session ;
910 @service store ;
1011
@@ -29,6 +30,6 @@ export default class ConfirmRoute extends Route {
2930 }
3031 }
3132
32- this . replaceWith ( 'index' ) ;
33+ this . router . replaceWith ( 'index' ) ;
3334 }
3435}
Original file line number Diff line number Diff line change 11import Route from '@ember/routing/route' ;
2+ import { inject as service } from '@ember/service' ;
23
34export default class VersionRoute extends Route {
5+ @service router ;
6+
47 async model ( ) {
58 let crate = this . modelFor ( 'crate' ) ;
69 let versions = await crate . get ( 'versions' ) ;
710
811 let { defaultVersion } = crate ;
912 let version = versions . find ( version => version . num === defaultVersion ) ?? versions . lastObject ;
1013
11- this . replaceWith ( 'crate.version-dependencies' , crate , version . num ) ;
14+ this . router . replaceWith ( 'crate.version-dependencies' , crate , version . num ) ;
1215 }
1316}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
44export default class CrateDocsRoute extends Route {
55 @service notifications ;
66 @service redirector ;
7+ @service router ;
78
89 redirect ( ) {
910 let crate = this . modelFor ( 'crate' ) ;
@@ -16,7 +17,7 @@ export default class CrateDocsRoute extends Route {
1617 // no documentation is found
1718 let message = 'Crate does not supply a documentation URL' ;
1819 this . notifications . error ( message ) ;
19- this . replaceWith ( 'crate' , crate ) ;
20+ this . router . replaceWith ( 'crate' , crate ) ;
2021 }
2122 }
2223}
Original file line number Diff line number Diff line change 11import Route from '@ember/routing/route' ;
2+ import { inject as service } from '@ember/service' ;
23
34export default class OwnersRoute extends Route {
5+ @service router ;
6+
47 redirect ( ) {
58 let crate = this . modelFor ( 'crate' ) ;
69
7- this . transitionTo ( 'crate.settings' , crate ) ;
10+ this . router . transitionTo ( 'crate.settings' , crate ) ;
811 }
912}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default class VersionRoute extends Route {
2323 let versionNum = maxSatisfying ( unyankedVersionNums , npmRange ) ?? maxSatisfying ( allVersionNums , npmRange ) ;
2424 if ( ! versionNum ) {
2525 this . notifications . error ( `No matching version of crate '${ crate . name } ' found for: ${ range } ` ) ;
26- this . replaceWith ( 'crate.index' ) ;
26+ this . router . replaceWith ( 'crate.index' ) ;
2727 }
2828
2929 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';
44export default class RepoRoute extends Route {
55 @service notifications ;
66 @service redirector ;
7+ @service router ;
78
89 redirect ( ) {
910 let crate = this . modelFor ( 'crate' ) ;
@@ -16,7 +17,7 @@ export default class RepoRoute extends Route {
1617 // no repository is found
1718 let message = 'Crate does not supply a repository URL' ;
1819 this . notifications . error ( message ) ;
19- this . replaceWith ( 'crate' , crate ) ;
20+ this . router . replaceWith ( 'crate' , crate ) ;
2021 }
2122 }
2223}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
33
44export default class ReverseDependenciesRoute extends Route {
55 @service notifications ;
6+ @service router ;
67 @service store ;
78
89 queryParams = {
@@ -25,7 +26,7 @@ export default class ReverseDependenciesRoute extends Route {
2526 }
2627
2728 this . notifications . error ( message ) ;
28- this . replaceWith ( 'index' ) ;
29+ this . router . replaceWith ( 'index' ) ;
2930 }
3031 }
3132
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
33
44export default class VersionRoute extends Route {
55 @service notifications ;
6+ @service router ;
67
78 async model ( params ) {
89 let crate = this . modelFor ( 'crate' ) ;
@@ -12,7 +13,7 @@ export default class VersionRoute extends Route {
1213 let version = versions . find ( version => version . num === requestedVersion ) ;
1314 if ( ! version ) {
1415 this . notifications . error ( `Version '${ requestedVersion } ' of crate '${ crate . name } ' does not exist` ) ;
15- this . replaceWith ( 'crate.index' ) ;
16+ this . router . replaceWith ( 'crate.index' ) ;
1617 }
1718
1819 try {
@@ -21,7 +22,7 @@ export default class VersionRoute extends Route {
2122 this . notifications . error (
2223 `Failed to load the list of dependencies for the '${ crate . name } ' crate. Please try again later!` ,
2324 ) ;
24- this . replaceWith ( 'crate.index' ) ;
25+ this . router . replaceWith ( 'crate.index' ) ;
2526 }
2627
2728 return version ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
44
55export default class KeywordRoute extends Route {
66 @service notifications ;
7+ @service router ;
78 @service store ;
89
910 async model ( { keyword_id } ) {
@@ -12,7 +13,7 @@ export default class KeywordRoute extends Route {
1213 } catch ( error ) {
1314 if ( error instanceof NotFoundError ) {
1415 this . notifications . error ( `Keyword '${ keyword_id } ' does not exist` ) ;
15- return this . replaceWith ( 'index' ) ;
16+ return this . router . replaceWith ( 'index' ) ;
1617 }
1718
1819 throw error ;
You can’t perform that action at this time.
0 commit comments