diff options
author | winh <winnie@gitlab.com> | 2017-05-22 17:51:18 +0200 |
---|---|---|
committer | winh <winnie@gitlab.com> | 2017-05-22 20:37:41 +0200 |
commit | 729a5a5b89c24aa3d3d991815f4dcb05270f640f (patch) | |
tree | 7e57d5a818921d56e69ccc194e1cf30147742648 /app | |
parent | e15aee2b51e4f03972fba490e2974a761acccf6c (diff) | |
download | gitlab-ce-winh-current-user-frontend-api.tar.gz |
Add frontend API method for current user (!11608)winh-current-user-frontend-api
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/api.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 6680834a8d1..45c5dd718a6 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -13,6 +13,7 @@ const Api = { dockerfilePath: '/api/:version/templates/dockerfiles/:key', issuableTemplatePath: '/:namespace_path/:project_path/templates/:type/:key', usersPath: '/api/:version/users.json', + currentUserPath: '/api/:version/user.json', group(groupId, callback) { const url = Api.buildUrl(Api.groupPath) @@ -149,6 +150,14 @@ const Api = { }); }, + currentUser() { + const url = Api.buildUrl(this.currentUserPath); + return Api.wrapAjaxCall({ + url, + dataType: 'json', + }); + }, + buildUrl(url) { let urlRoot = ''; if (gon.relative_url_root != null) { |