diff options
Diffstat (limited to 'app/assets/javascripts/emoji/awards_app/store/actions.js')
-rw-r--r-- | app/assets/javascripts/emoji/awards_app/store/actions.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/emoji/awards_app/store/actions.js b/app/assets/javascripts/emoji/awards_app/store/actions.js index e7c49b2a4f9..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 { @@ -16,7 +17,9 @@ 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']; @@ -35,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); |