diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-06-10 17:37:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-10 17:37:21 +0200 |
commit | c6c7bf08a06b6884785cc12e5d39e20ed9b3a36b (patch) | |
tree | 856f132b1fff3687ef27d1fbca4f708884661521 /server/sonar-web/src/main/js/api | |
parent | c321ee96905615ae8608e3047c5a5f0695e65bf2 (diff) | |
download | sonarqube-c6c7bf08a06b6884785cc12e5d39e20ed9b3a36b.tar.gz sonarqube-c6c7bf08a06b6884785cc12e5d39e20ed9b3a36b.zip |
refactor react components (#1033)
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r-- | server/sonar-web/src/main/js/api/favorites.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/api/favorites.js b/server/sonar-web/src/main/js/api/favorites.js new file mode 100644 index 00000000000..c9e61cd2ad4 --- /dev/null +++ b/server/sonar-web/src/main/js/api/favorites.js @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { post, requestDelete } from '../helpers/request'; + +export function addFavorite (componentKey) { + const url = window.baseUrl + '/api/favourites'; + const data = { key: componentKey }; + return post(url, data); +} + +export function removeFavorite (componentKey) { + const url = window.baseUrl + + '/api/favourites/' + encodeURIComponent(componentKey); + return requestDelete(url); +} |