Skip to content

Commit 976e8e8

Browse files
committed
Use Redirector service instead of setting window.location
That makes the routes work under FastBoot.
1 parent 952e8ba commit 976e8e8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/routes/crate/docs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { inject as service } from '@ember/service';
33

44
export default Route.extend({
55
flashMessages: service(),
6+
redirector: service(),
67

78
redirect() {
89
let crate = this.modelFor('crate');
910

1011
let documentation = crate.get('documentation');
1112
if (documentation) {
12-
window.location = documentation;
13+
this.redirector.redirectTo(documentation);
1314
} else {
1415
// Redirect to the crate's main page and show a flash error if
1516
// no documentation is found

app/routes/crate/repo.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { inject as service } from '@ember/service';
33

44
export default Route.extend({
55
flashMessages: service(),
6+
redirector: service(),
67

78
redirect() {
89
let crate = this.modelFor('crate');
910

1011
let repository = crate.get('repository');
1112
if (repository) {
12-
window.location = repository;
13+
this.redirector.redirectTo(repository);
1314
} else {
1415
// Redirect to the crate's main page and show a flash error if
1516
// no repository is found

0 commit comments

Comments
 (0)