diff options
Diffstat (limited to 'app/assets/javascripts/emoji/awards_app')
-rw-r--r-- | app/assets/javascripts/emoji/awards_app/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/awards_app/store/actions.js | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/emoji/awards_app/index.js b/app/assets/javascripts/emoji/awards_app/index.js index 16268910f49..1a084d37762 100644 --- a/app/assets/javascripts/emoji/awards_app/index.js +++ b/app/assets/javascripts/emoji/awards_app/index.js @@ -32,7 +32,7 @@ export default (el) => { canAwardEmoji: this.canAwardEmoji, currentUserId: this.currentUserId, defaultAwards: ['thumbsup', 'thumbsdown'], - selectedClass: 'gl-bg-blue-50! is-active', + selectedClass: 'selected', }, on: { award: this.toggleAward, diff --git a/app/assets/javascripts/emoji/awards_app/store/actions.js b/app/assets/javascripts/emoji/awards_app/store/actions.js index 482acc5a3a9..f0340209248 100644 --- a/app/assets/javascripts/emoji/awards_app/store/actions.js +++ b/app/assets/javascripts/emoji/awards_app/store/actions.js @@ -1,6 +1,7 @@ import * as Sentry from '@sentry/browser'; import axios from '~/lib/utils/axios_utils'; import { normalizeHeaders } from '~/lib/utils/common_utils'; +import { joinPaths } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import showToast from '~/vue_shared/plugins/global_toast'; import { @@ -13,8 +14,12 @@ import { export const setInitialData = ({ commit }, data) => commit(SET_INITIAL_DATA, data); export const fetchAwards = async ({ commit, dispatch, state }, page = '1') => { + if (!window.gon?.current_user_id) return; + try { - const { data, headers } = await axios.get(state.path, { params: { per_page: 100, page } }); + const { data, headers } = await axios.get(joinPaths(gon.relative_url_root || '', state.path), { + params: { per_page: 100, page }, + }); const normalizedHeaders = normalizeHeaders(headers); const nextPage = normalizedHeaders['X-NEXT-PAGE']; @@ -33,13 +38,15 @@ export const toggleAward = async ({ commit, state }, name) => { try { if (award) { - await axios.delete(`${state.path}/${award.id}`); + await axios.delete(joinPaths(gon.relative_url_root || '', `${state.path}/${award.id}`)); commit(REMOVE_AWARD, award.id); showToast(__('Award removed')); } else { - const { data } = await axios.post(state.path, { name }); + const { data } = await axios.post(joinPaths(gon.relative_url_root || '', state.path), { + name, + }); commit(ADD_NEW_AWARD, data); |