From 463a83b4590ceee854a0cae5ee6a0461463a0658 Mon Sep 17 00:00:00 2001 From: Bouncey Date: Fri, 15 Feb 2019 14:14:08 +0000 Subject: [PATCH] fix: Do not use relative api locations --- .../Donation/components/DonateForm.js | 2 +- client/src/utils/ajax.js | 25 +++---------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/client/src/components/Donation/components/DonateForm.js b/client/src/components/Donation/components/DonateForm.js index 47d6ed7f78..b0eeeade59 100644 --- a/client/src/components/Donation/components/DonateForm.js +++ b/client/src/components/Donation/components/DonateForm.js @@ -121,7 +121,7 @@ class DonateForm extends Component { })); const chargeStripePath = isSignedIn ? - '/internal/donate/charge-stripe' : + `${apiLocation}/internal/donate/charge-stripe` : `${apiLocation}/unauthenticated/donate/charge-stripe`; return postJSON$(chargeStripePath, { token, diff --git a/client/src/utils/ajax.js b/client/src/utils/ajax.js index 5d522cc5f3..4743eadd27 100644 --- a/client/src/utils/ajax.js +++ b/client/src/utils/ajax.js @@ -1,7 +1,8 @@ import axios from 'axios'; -import qs from 'query-string'; -const base = '/internal'; +import { apiLocation } from '../../config/env.json'; + +const base = `${apiLocation}/internal`; function get(path) { return axios.get(`${base}${path}`); @@ -42,29 +43,11 @@ export function getUsernameExists(username) { } export function getArticleById(shortId) { - return get( - `/n/${shortId}` - ); -} - -export function getFeaturedList(skip = 0) { - return get( - `/api/articles?${qs.stringify({ - filter: JSON.stringify({ - where: { featured: true, published: true }, - order: 'firstPublishedDate DESC', - limit: 10, - skip - }) - })}` - ); + return get(`/n/${shortId}`); } /** POST **/ -export function postPopularityEvent(event) { - return post('/p', event); -} export function postReportUser(body) { return post('/user/report-user', body);