diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-12-16 15:57:32 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-12-19 10:50:04 +0100 |
commit | 6a489759fdf4bf4332c193d51d5c77988706a449 (patch) | |
tree | cb41ac865f38f91a6aed46decc17310671e4f908 /server/sonar-web/src/main/js | |
parent | 95ab6f6776c4b8e4ead3a4f6215c9c03c9b475c5 (diff) | |
download | sonarqube-6a489759fdf4bf4332c193d51d5c77988706a449.tar.gz sonarqube-6a489759fdf4bf4332c193d51d5c77988706a449.zip |
SONAR-7288 Use api/favorites/remove in the UI
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/api/favorites.js | 9 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/source-viewer/header.js | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/api/favorites.js b/server/sonar-web/src/main/js/api/favorites.js index 7b87df6ea42..22267399457 100644 --- a/server/sonar-web/src/main/js/api/favorites.js +++ b/server/sonar-web/src/main/js/api/favorites.js @@ -18,17 +18,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* @flow */ -import { post, requestDelete, getJSON } from '../helpers/request'; +import { post, getJSON } from '../helpers/request'; export const getFavorites = (): Promise<Object> => ( getJSON('/api/favourites') ); export function addFavorite (component: string) { - return post('/api/favorites/add', { component}); + return post('/api/favorites/add', { component }); } -export function removeFavorite (componentKey: string) { - const url = '/api/favourites/' + encodeURIComponent(componentKey); - return requestDelete(url); +export function removeFavorite (component: string) { + return post('/api/favorites/remove', { component }); } diff --git a/server/sonar-web/src/main/js/components/source-viewer/header.js b/server/sonar-web/src/main/js/components/source-viewer/header.js index be78f9e41bf..b632622917b 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/header.js +++ b/server/sonar-web/src/main/js/components/source-viewer/header.js @@ -25,7 +25,6 @@ import MoreActionsView from './more-actions'; import MeasuresOverlay from './measures-overlay'; import Template from './templates/source-viewer-header.hbs'; -const API_FAVOURITE: string = window.baseUrl + '/api/favourites'; const API_FAVORITE: string = window.baseUrl + '/api/favorites'; export default Marionette.ItemView.extend({ @@ -43,8 +42,11 @@ export default Marionette.ItemView.extend({ const that = this; if (this.model.get('fav')) { $.ajax({ - url: API_FAVOURITE + '/' + this.model.get('key'), - type: 'DELETE' + url: API_FAVORITE + '/remove', + type: 'POST', + data: { + component: this.model.get('key') + } }).done(function () { that.model.set('fav', false); that.render(); |