Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Commit 15bae2e

Browse files
committed
Fix the v1 API version selector (include dev versions again for a12s)
In rest-proxy mode (the production configuration), we need to send the `/versions` request through the rest-proxy as well so that it will be authenticated.
1 parent b49be1c commit 15bae2e

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎lib/api/com.js‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ function parseEndpoints(data, version) {
1717
return data;
1818
}
1919

20-
function loadVersions(callback) {
20+
function loadVersions(send, callback) {
2121
// Strange having to specify a version to retrieve versions :)
22-
$.ajax({
23-
type: 'GET',
24-
url: baseUrl + 'v1.1/versions?include_dev=true',
25-
headers: $.extend({'accept':'application/json'}),
26-
success: function(data) {
22+
send({
23+
path: '/versions',
24+
query: { include_dev: true },
25+
version: '1.1',
26+
}, function(err, response, xhr) {
27+
if (err) {
28+
callback({
29+
status: xhr.status,
30+
error: err,
31+
errorType: err,
32+
body: xhr.response,
33+
});
34+
} else {
2735
callback(
2836
undefined,
29-
data.versions.map(function(version) {
37+
response.versions.map(function(version) {
3038
return 'v' + version;
3139
}),
32-
'v' + data.current_version
40+
'v' + response.current_version
3341
);
34-
},
35-
error: function(xhr, errorType, error) {
36-
callback({
37-
status: xhr.status,
38-
error: error,
39-
errorType: errorType,
40-
body: xhr.response,
41-
});
4242
}
4343
});
4444
}

‎lib/api/core.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function parseEndpoints(data) {
6969
return endpoints;
7070
}
7171

72-
function loadVersions(callback) {
72+
function loadVersions(send, callback) {
7373
callback(undefined, namespaces, namespaces[0]);
7474
}
7575

‎lib/app.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var
3535
},
3636
'onLoadVersions': function(onLoad) {
3737
var api = apiFactory.get(apiSelector.getValue());
38-
api.loadVersions(onLoad);
38+
api.loadVersions(send, onLoad);
3939
},
4040
'onLoadEndpoints': function(version, onEndpoints) {
4141
// TODO: stash endpoints in local storage so we can load them immediately in the future

0 commit comments

Comments
 (0)