summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/api.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-08-17 09:29:59 +0100
committerPhil Hughes <me@iamphill.com>2018-08-17 09:29:59 +0100
commitd80149e60e0bfe6d5ea58a6d25a56914f1f2848e (patch)
treeba810f682f2c3a6ee17f84785d828d5e6b3e901c /app/assets/javascripts/api.js
parentbba7504438d5cc4ea98500754c8d0a8b9ff1fc42 (diff)
downloadgitlab-ce-d80149e60e0bfe6d5ea58a6d25a56914f1f2848e.tar.gz
Added store for file templates in the Web IDE
#47947
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r--app/assets/javascripts/api.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js
index 25fe2ae553e..cd800d75f7a 100644
--- a/app/assets/javascripts/api.js
+++ b/app/assets/javascripts/api.js
@@ -15,6 +15,7 @@ const Api = {
mergeRequestChangesPath: '/api/:version/projects/:id/merge_requests/:mrid/changes',
mergeRequestVersionsPath: '/api/:version/projects/:id/merge_requests/:mrid/versions',
groupLabelsPath: '/groups/:namespace_path/-/labels',
+ templatesPath: '/api/:version/templates/:key',
licensePath: '/api/:version/templates/licenses/:key',
gitignorePath: '/api/:version/templates/gitignores/:key',
gitlabCiYmlPath: '/api/:version/templates/gitlab_ci_ymls/:key',
@@ -265,6 +266,12 @@ const Api = {
});
},
+ templates(key, params = {}) {
+ const url = Api.buildUrl(this.templatesPath).replace(':key', key);
+
+ return axios.get(url, { params });
+ },
+
buildUrl(url) {
let urlRoot = '';
if (gon.relative_url_root != null) {