diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2018-03-12 12:06:11 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk@users.noreply.github.com> | 2018-03-13 14:05:36 +0100 |
commit | 913c82c8772fd4747626a1fbe665ccda2e5ca9f1 (patch) | |
tree | d48784851df80905ce125cc60ac8aec8570751a9 /server/sonar-web/src/main/js/api/branches.ts | |
parent | 751e4000e40a4af66b80767d632b1bef64dc5647 (diff) | |
download | sonarqube-913c82c8772fd4747626a1fbe665ccda2e5ca9f1.tar.gz sonarqube-913c82c8772fd4747626a1fbe665ccda2e5ca9f1.zip |
SONAR-10374 Support pull request in the web app
Diffstat (limited to 'server/sonar-web/src/main/js/api/branches.ts')
-rw-r--r-- | server/sonar-web/src/main/js/api/branches.ts | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/api/branches.ts b/server/sonar-web/src/main/js/api/branches.ts index 02ce5fe693e..9cb5dbaec27 100644 --- a/server/sonar-web/src/main/js/api/branches.ts +++ b/server/sonar-web/src/main/js/api/branches.ts @@ -18,16 +18,28 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { getJSON, post } from '../helpers/request'; +import { Branch, PullRequest } from '../app/types'; import throwGlobalError from '../app/utils/throwGlobalError'; -export function getBranches(project: string): Promise<any> { +export function getBranches(project: string): Promise<Branch[]> { return getJSON('/api/project_branches/list', { project }).then(r => r.branches, throwGlobalError); } -export function deleteBranch(project: string, branch: string): Promise<void | Response> { - return post('/api/project_branches/delete', { project, branch }).catch(throwGlobalError); +export function getPullRequests(project: string): Promise<PullRequest[]> { + return getJSON('/api/project_pull_requests/list', { project }).then( + r => r.pullRequests, + throwGlobalError + ); } -export function renameBranch(project: string, name: string): Promise<void | Response> { +export function deleteBranch(data: { branch: string; project: string }) { + return post('/api/project_branches/delete', data).catch(throwGlobalError); +} + +export function deletePullRequest(data: { project: string; pullRequest: string }) { + return post('/api/project_pull_requests/delete', data).catch(throwGlobalError); +} + +export function renameBranch(project: string, name: string) { return post('/api/project_branches/rename', { project, name }).catch(throwGlobalError); } |