Lint request.js

This commit is contained in:
Grégoire Delattre 2017-06-02 21:23:21 +02:00
parent 14a0f19aa8
commit 2beb872de9

View File

@ -1,12 +1,12 @@
import axios from 'axios'
import axios from "axios"
// This functions returns an axios instance, the token is added to the
// configuration if found in the localStorage
export function configureAxios(headers = {}) {
// Get the token from the localStorate
const token = localStorage.getItem('token');
const token = localStorage.getItem("token");
if (token) {
headers = { 'Authorization': `Bearer ${token}` };
headers = { "Authorization": `Bearer ${token}` };
}
return axios.create({
@ -30,10 +30,10 @@ export function request(eventPrefix, promise, callbackEvents = null, mainPayload
})
promise
.then(response => {
if (response.data.status === 'error')
if (response.data.status === "error")
{
dispatch({
type: 'ADD_ALERT_ERROR',
type: "ADD_ALERT_ERROR",
payload: {
message: response.data.message,
main: mainPayload,
@ -58,11 +58,11 @@ export function request(eventPrefix, promise, callbackEvents = null, mainPayload
// Unauthorized
if (error.response && error.response.status == 401) {
dispatch({
type: 'USER_LOGOUT',
type: "USER_LOGOUT",
})
}
dispatch({
type: 'ADD_ALERT_ERROR',
type: "ADD_ALERT_ERROR",
payload: {
message: error.response.data,
main: mainPayload,