Refact/project (#189)

* refactor: cleanup project entry point
* refactor: remove unused
* refactor: folder restructure
This commit is contained in:
Carlos Valente
2022-08-03 23:20:23 +02:00
committed by GitHub
parent 05be0c1e95
commit 9b5d536378
116 changed files with 352 additions and 942 deletions
+54
View File
@@ -0,0 +1,54 @@
import axios from 'axios';
import { eventsURL } from './apiConstants';
/**
* @description HTTP request to fetch all events
* @return {Promise}
*/
export const fetchAllEvents = async () => {
const res = await axios.get(eventsURL);
return res.data;
};
/**
* @description HTTP request to post new event
* @return {Promise}
*/
export const requestPost = async (data) => axios.post(eventsURL, data);
/**
* @description HTTP request to put new event
* @return {Promise}
*/
export const requestPut = async (data) => axios.put(eventsURL, data);
/**
* @description HTTP request to modify event
* @return {Promise}
*/
export const requestPatch = async (data) => axios.patch(eventsURL, data);
/**
* @description HTTP request to reorder events
* @return {Promise}
*/
export const requestReorder = async (data) => axios.patch(`${eventsURL}/reorder`, data);
/**
* @description HTTP request to request application of delay
* @return {Promise}
*/
export const requestApplyDelay = async (eventId) => axios.patch(`${eventsURL}/applydelay/${eventId}`);
/**
* @description HTTP request to delete given event
* @return {Promise}
*/
export const requestDelete = async (eventId) => axios.delete(`${eventsURL}/${eventId}`);
/**
* @description HTTP request to delete all events
* @return {Promise}
*/
export const requestDeleteAll = async () => axios.delete(`${eventsURL}/all`);