|
|
|
@ -10,17 +10,19 @@ const localStorage = global.process && process.env.NODE_ENV === "test" |
|
|
|
|
|
|
|
|
|
function headers() { |
|
|
|
|
const token = localStorage.getItem("userToken") || ""; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
let header = { |
|
|
|
|
Accept: "application/json", |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
Authorization: `Token ${token}` |
|
|
|
|
"Content-Type": "application/json" |
|
|
|
|
}; |
|
|
|
|
if (token) { |
|
|
|
|
header["Authorization"] = `Token ${token}`; |
|
|
|
|
} |
|
|
|
|
return header; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const apiInstance = axios.create({ |
|
|
|
|
baseURL: API_ENDPOINT, |
|
|
|
|
timeout: 3000, |
|
|
|
|
timeout: 3000 |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
export function get(url, params = {}) { |
|
|
|
|