diff --git a/frontend/quasar.config.js b/frontend/quasar.config.js index 31c17a60..5f9f939c 100644 --- a/frontend/quasar.config.js +++ b/frontend/quasar.config.js @@ -97,6 +97,12 @@ export default configure((ctx) => { devServer: { // https: true open: true, // opens browser window automatically + + proxy: { + '/api': { + target: 'http://localhost:3000', + }, + }, }, // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework diff --git a/frontend/src/boot/axios.ts b/frontend/src/boot/axios.ts index 3d0f08a6..6dd4c357 100644 --- a/frontend/src/boot/axios.ts +++ b/frontend/src/boot/axios.ts @@ -7,12 +7,6 @@ declare module '@vue/runtime-core' { } } -// Resolve url depending on environment -const apiUrl = - window.location.hostname === 'localhost' - ? 'http://localhost:3000' - : window.origin; - // Be careful when using SSR for cross-request state pollution // due to creating a Singleton instance here; // If any client changes this (global) instance, it might be a @@ -20,7 +14,7 @@ const apiUrl = // "export default () => {}" function below (which runs individually // for each client) const api = axios.create({ - baseURL: `${apiUrl}/api/v1/`, + baseURL: `${window.origin}/api/v1/`, // Needed for auth withCredentials: true, });