Skip to content

Commit fac7766

Browse files
committed
Make /install work under FastBoot
1 parent 4a1542c commit fac7766

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

app/routes/install.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
import Route from '@ember/routing/route';
2+
import { inject as service } from '@ember/service';
23

34
export default Route.extend({
5+
fastboot: service(),
6+
47
redirect() {
5-
window.location = 'https://doc.rust-lang.org/cargo/getting-started/installation.html';
8+
this._redirectTo('https://doc.rust-lang.org/cargo/getting-started/installation.html');
9+
},
10+
11+
_redirectTo(url) {
12+
if (this.fastboot.isFastBoot) {
13+
let headers = this.fastboot.response.headers;
14+
headers.set('location', url);
15+
this.set('fastboot.response.statusCode', 301);
16+
} else {
17+
window.location = url;
18+
}
619
},
720
});

0 commit comments

Comments
 (0)