diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-10 12:08:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-10 12:08:45 +0300 |
commit | 01c201bc6a9b99e1f3095f4139110c6fd0cf7aa9 (patch) | |
tree | 7445a1fc4797d9f093c3b1352cf3889fadc6d967 /app/assets/javascripts/api.js | |
parent | 552db97a0dfa486b751a808eb4e9fadc8b875e9c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 7de827f0176..a887c22af2e 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -34,6 +34,7 @@ const Api = { mergeRequestsPath: '/api/:version/merge_requests', groupLabelsPath: '/groups/:namespace_path/-/labels', issuableTemplatePath: '/:namespace_path/:project_path/templates/:type/:key', + issuableTemplatesPath: '/:namespace_path/:project_path/templates/:type', projectTemplatePath: '/api/:version/projects/:id/templates/:type/:key', projectTemplatesPath: '/api/:version/projects/:id/templates/:type', userCountsPath: '/api/:version/user_counts', @@ -460,17 +461,38 @@ const Api = { }, issueTemplate(namespacePath, projectPath, key, type, callback) { - const url = Api.buildUrl(Api.issuableTemplatePath) - .replace(':key', encodeURIComponent(key)) - .replace(':type', type) - .replace(':project_path', projectPath) - .replace(':namespace_path', namespacePath); + const url = this.buildIssueTemplateUrl( + Api.issuableTemplatePath, + type, + projectPath, + namespacePath, + ).replace(':key', encodeURIComponent(key)); return axios .get(url) .then(({ data }) => callback(null, data)) .catch(callback); }, + issueTemplates(namespacePath, projectPath, type, callback) { + const url = this.buildIssueTemplateUrl( + Api.issuableTemplatesPath, + type, + projectPath, + namespacePath, + ); + return axios + .get(url) + .then(({ data }) => callback(null, data)) + .catch(callback); + }, + + buildIssueTemplateUrl(path, type, projectPath, namespacePath) { + return Api.buildUrl(path) + .replace(':type', type) + .replace(':project_path', projectPath) + .replace(':namespace_path', namespacePath); + }, + users(query, options) { const url = Api.buildUrl(this.usersPath); return axios.get(url, { |