diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-10 19:41:15 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-10 20:00:43 +0000 |
commit | 86558d53ddcf008fff396d25c38c9462fb77f615 (patch) | |
tree | 58c1a6f9f7436eae0ec5b75094326c6872f01a2f /app/assets | |
parent | 4f265c3bbc10130f57d79c90c7063b66ae173a94 (diff) | |
download | gitlab-ce-86558d53ddcf008fff396d25c38c9462fb77f615.tar.gz |
Adds verification in case the endpoint already has `.json`
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/commit/pipelines/pipelines_service.js.es6 | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/assets/javascripts/commit/pipelines/pipelines_service.js.es6 b/app/assets/javascripts/commit/pipelines/pipelines_service.js.es6 index e9cae893857..8ae98f9bf97 100644 --- a/app/assets/javascripts/commit/pipelines/pipelines_service.js.es6 +++ b/app/assets/javascripts/commit/pipelines/pipelines_service.js.es6 @@ -8,8 +8,23 @@ * Uses Vue.Resource */ class PipelinesService { - constructor(endpoint) { - this.pipelines = Vue.resource(`${endpoint}.json`); + + /** + * FIXME: The url provided to request the pipelines in the new merge request + * page already has `.json`. + * This should be fixed when the endpoint is improved. + * + * @param {String} root + */ + constructor(root) { + let endpoint; + + if (root.indexOf('.json') === -1) { + endpoint = `${root}.json`; + } else { + endpoint = root; + } + this.pipelines = Vue.resource(endpoint); } /** |