Ali Hallaji
Ali Hallaji

Reputation: 4392

Set API URL for Quasar in the Electron mode build

I want to set my API URL for Electron mode. When I built my code to Electron production mode, All of my API URLs disappear first of the URL such as this: file:///core/v1/api/main/login

How can I set my API URL(an external IP address) for Electron mode in Production?

Upvotes: 1

Views: 1516

Answers (1)

Ali Hallaji
Ali Hallaji

Reputation: 4392

I found the solution. for this case, we could change the axios.js in the boot directory.

For example, I need to change the baseURL to another when I build to Electron mode.

if (process.env.MODE === 'electron') {
  var axiosInstance = axios.create({
    baseURL: process.env.API_URL
  })
  Vue.prototype.$axios = axiosInstance
} else {
  Vue.prototype.$axios = axios
}

Upvotes: 1

Related Questions