- Cleanup

This commit is contained in:
2019-08-06 01:36:08 -04:00
parent 6e71ac688a
commit b8ddc54b99
43 changed files with 361 additions and 170 deletions

View File

@@ -11,7 +11,7 @@ import { API_URL } from '../constants/constants.js';
const DefaultRequestOptions = {};
const endpoints = {
export const API_ENDPOINTS = {
// Events and Items
GET_EVENTS: '/events',
// GET_ITEMS: '/items?eventId=:event_id',
@@ -23,6 +23,9 @@ const endpoints = {
PLACE_BID: '/bids/:item_id',
PURCHASE_ITEM: '/sales',
// Login
LOGIN: '/auth',
// User/Profile
USER_SIGNUP: '/signup',
USER_PROFILE: '/users/:user_id',
@@ -42,11 +45,11 @@ const cacheBuster = () => {
};
export const getEndpointUrl = (endpoint) => {
if (!endpoints[endpoint]) {
if (!API_ENDPOINTS[endpoint]) {
throw new Error('Invalid API endpoint specified');
}
return `${API_URL}${endpoints[endpoint]}`; //`${cacheBuster()}`;
return `${API_URL}${API_ENDPOINTS[endpoint]}`; //`${cacheBuster()}`;
};
export const requestGet = (path, queryParams = [], requestOptions = {}) => {