change baseurl

This commit is contained in:
Sina Blattmann 2023-07-06 15:01:16 +02:00
parent 4b873306e3
commit 72ced4be3e
1 changed files with 25 additions and 25 deletions

View File

@ -1,25 +1,25 @@
import axios from "axios"; import axios from "axios";
export const axiosConfigWithoutToken = axios.create({ export const axiosConfigWithoutToken = axios.create({
baseURL: "https://localhost:7087/api", baseURL: "https://monitor.innov.energy:5000/api",
}); });
const axiosConfig = axios.create({ const axiosConfig = axios.create({
baseURL: "https://localhost:7087/api", baseURL: "https://monitor.innov.energy:5000/api",
}); });
axiosConfig.defaults.params = {}; axiosConfig.defaults.params = {};
axiosConfig.interceptors.request.use( axiosConfig.interceptors.request.use(
(config) => { (config) => {
const tokenString = localStorage.getItem("token"); const tokenString = localStorage.getItem("token");
const token = tokenString !== null ? JSON.parse(tokenString) : ""; const token = tokenString !== null ? JSON.parse(tokenString) : "";
if (token) { if (token) {
config.params["authToken"] = token; config.params["authToken"] = token;
} }
return config; return config;
}, },
(error) => { (error) => {
return Promise.reject(error); return Promise.reject(error);
} }
); );
export default axiosConfig; export default axiosConfig;