Skip to content

Commit b8278e7

Browse files
committed
Show latest version
1 parent 013bfc3 commit b8278e7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

addon/services/project-version.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export default Service.extend({
99
root: null,
1010

1111
_loadAvailableVersions: task(function*() {
12-
let { rootURL } = getOwner(this).resolveRegistration('config:environment');
12+
let config = getOwner(this).resolveRegistration('config:environment');
13+
let rootURL = config.rootURL;
14+
let tag = config['ember-cli-addon-docs'].packageJson.version;
1315
let slash = rootURL.indexOf('/', 1);
1416

1517
// TODO deal with apps deployed to custom domains, so their pathnames don't have a leading
@@ -19,7 +21,7 @@ export default Service.extend({
1921
this.set('current', currentFromURL || 'latest'); // dev-time guard. Think of a better way?
2022

2123
let response = yield fetch(`${this.get('root')}/versions.json`);
22-
let json = yield response.ok ? response.json() : [{ name: 'latest', sha: 'abcde', path: '/' }];
24+
let json = yield response.ok ? response.json() : [{ name: 'latest', tag, sha: '12345', path: '/' }];
2325

2426
this.set('versions', Object.keys(json).map(key => {
2527
let version = json[key];

0 commit comments

Comments
 (0)