fix: Do not use relative api locations

This commit is contained in:
Bouncey
2019-02-15 14:14:08 +00:00
committed by Stuart Taylor
parent 6221a85d14
commit 463a83b459
2 changed files with 5 additions and 22 deletions

View File

@ -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,

View File

@ -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);