Created
October 8, 2022 05:45
-
-
Save devAgam/815a8bda1968175c4ce6d12fcffa8d1e to your computer and use it in GitHub Desktop.
ENV Url ternary handler
This file contains hidden or 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"; | |
const baseUrlMainServer = | |
process.env.ENV === "PROD" | |
? "https://api.project28.in" | |
: process.env.ENV === "QA" | |
? "https://qa.project28.in" | |
: (process.env.ENV = "DEV" | |
? "https://backend-staging.project28.in" | |
: "http://localhost:5000"); | |
// const baseUrlMainServer = "http://localhost:5000/api/v1"; | |
export default axios.create({ | |
baseURL: baseUrlMainServer + "/api/v1", | |
withCredentials: true, | |
headers: { "Content-Type": "application/json" }, | |
}); | |
export const axiosPrivate = axios.create({ | |
baseURL: baseUrlMainServer + "/api/v1", | |
headers: { "Content-Type": "application/json" }, | |
withCredentials: true, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment