Skip to content

Instantly share code, notes, and snippets.

@devAgam
Created October 8, 2022 05:45
Show Gist options
  • Save devAgam/77d7358dbff592c07ca12c841cabff20 to your computer and use it in GitHub Desktop.
Save devAgam/77d7358dbff592c07ca12c841cabff20 to your computer and use it in GitHub Desktop.
URL Ternary decider
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