- more!
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { API_ENDPOINTS, requestGet } from './index.js';
|
||||
|
||||
export const fetchEvents = (auth) => {
|
||||
const path = String(API_ENDPOINTS.GET_EVENTS);
|
||||
const opts = { Authorization: auth ? `Bearer ${auth}` : null };
|
||||
return requestGet(path, null, opts);
|
||||
return requestGet(API_ENDPOINTS.GET_EVENTS, null, opts);
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ import { API_URL } from '../constants/constants.js';
|
||||
|
||||
const DefaultRequestOptions = {};
|
||||
|
||||
export const API_ENDPOINTS = {
|
||||
const endpoints = {
|
||||
// Events and Items
|
||||
GET_EVENTS: '/events',
|
||||
// GET_ITEMS: '/items?eventId=:event_id',
|
||||
@@ -23,13 +23,13 @@ export const API_ENDPOINTS = {
|
||||
PLACE_BID: '/bids/:item_id',
|
||||
PURCHASE_ITEM: '/sales',
|
||||
|
||||
// Login
|
||||
LOGIN: '/auth',
|
||||
|
||||
// User/Profile
|
||||
USER_SIGNUP: '/signup',
|
||||
USER_PROFILE: '/users/:user_id',
|
||||
|
||||
VALIDATE_SIGNUP_EMAIL: '/signup/validate/email',
|
||||
VALIDATE_SIGNUP_NOM: '/signup/validate/nom',
|
||||
|
||||
// Services
|
||||
APPLE_SIGNUP: '/auth/apple/login',
|
||||
APPLE_LINK: '/auth/apple/link',
|
||||
@@ -45,11 +45,11 @@ const cacheBuster = () => {
|
||||
};
|
||||
|
||||
export const getEndpointUrl = (endpoint) => {
|
||||
if (!API_ENDPOINTS[endpoint]) {
|
||||
if (!endpoints[endpoint]) {
|
||||
throw new Error('Invalid API endpoint specified');
|
||||
}
|
||||
|
||||
return `${API_URL}${API_ENDPOINTS[endpoint]}`; //`${cacheBuster()}`;
|
||||
return `${API_URL}${endpoints[endpoint]}`; //`${cacheBuster()}`;
|
||||
};
|
||||
|
||||
export const requestGet = (path, queryParams = [], requestOptions = {}) => {
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import { API_ENDPOINTS, requestGet } from './index.js';
|
||||
|
||||
export const getEmailAvailability = (email) => {
|
||||
};
|
||||
export const getEmailAvailability = (email) => requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_EMAIL}/&{encodeURI(email)}`);
|
||||
|
||||
export const getNomAvailaibility = (nomDeBid) => {
|
||||
};
|
||||
export const getNomAvailaibility = (nomDeBid) => requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_NOM}/${encodeURI(nomDeBid)}`);
|
||||
|
||||
export const loginUser = (username, password) => {
|
||||
const path = String(API_ENDPOINTS.LOGIN);
|
||||
return requestPost({
|
||||
path: API_ENDPOINTS.LOGIN,
|
||||
body: { username, password },
|
||||
});
|
||||
};
|
||||
export const loginUser = (username, password) => requestPost({
|
||||
path: API_ENDPOINTS.LOGIN,
|
||||
body: { username, password },
|
||||
});
|
||||
|
||||
export const registerNewUser = (user) => {
|
||||
};
|
||||
export const registerNewUser = (user) => requestPost({
|
||||
path: API_ENDPOINTS.USER_SIGNUP,
|
||||
body: { user },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user