This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Status = { | |
Ok: 200, | |
Unassigned: 299, | |
BadRequest: 400, | |
Unauthorized: 401, | |
NotFound: 404, | |
}; | |
export const Methods = { | |
Get: "GET", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
require("dotenv").config(); | |
const authTokenKey = "blabla"; /* Example of a bearer token stored in localStorage */ | |
/*Axios configuration*/ | |
const axiosInstance = axios.create({ | |
baseURL: process.env.REACT_APP_API_URL, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Status = { | |
Ok: 200, | |
Unassigned: 299, | |
BadRequest: 400, | |
Unauthorized: 401, | |
NotFound: 404, | |
}; | |
export const Methods = { | |
Get: "GET", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class FormHelper { | |
/** | |
* Check input for validity using JavaScript/HTML5 client-side form validation | |
* Link : https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation | |
* @param {object} target - e.g. JavaScript event.target or selected HTML element object | |
* @returns {string []} - Errors list | |
*/ | |
static inputValidation = (target) => { | |
if (!target) return null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Date functions*/ | |
/** | |
* Returns the number of the current week | |
* @returns {number} - Number of the current week | |
*/ | |
Date.prototype.getWeek = function() | |
{ | |
var date = new Date(this.getTime()); | |
date.setHours(0, 0, 0, 0); | |
// Thursday in current week decides the year. |