Amend API path

This commit is contained in:
2025-07-15 14:45:22 +02:00
parent 00759473f2
commit c942450e86
4 changed files with 18 additions and 13 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "dex-ui-vue", "name": "dex-ui-vue",
"version": "0.0.1", "version": "0.0.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@@ -1,7 +1,7 @@
{ {
"name": "dex-ui-vue", "name": "dex-ui-vue",
"private": true, "private": true,
"version": "0.0.1", "version": "0.0.2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -27,16 +27,11 @@ import axiosInstance from "./api";
import SetsView from "./views/set/SetsView.vue"; import SetsView from "./views/set/SetsView.vue";
import JobsView from "./views/JobsView.vue"; import JobsView from "./views/JobsView.vue";
import {definePreset} from "@primeuix/themes"; import {definePreset} from "@primeuix/themes";
import {getConfig, initConfig} from "@/util/config.ts"; import {initConfig} from "@/util/config.ts";
// Initialize configuration from window object // Initialize configuration from window object
initConfig((window as any).__APP_CONFIG__ || {}) initConfig((window as any).__APP_CONFIG__ || {})
// Use the config in your app
const config = getConfig()
console.log('API Base URL:', config.API_BASE_URL)
export const DeckServiceKey = Symbol("deckServiceKey") export const DeckServiceKey = Symbol("deckServiceKey")
export const CardServiceKey = Symbol("cardServiceKey") export const CardServiceKey = Symbol("cardServiceKey")
export const SetServiceKey = Symbol("setServiceKey") export const SetServiceKey = Symbol("setServiceKey")
@@ -144,11 +139,11 @@ router.beforeEach(async (to) => {
app.use(router); app.use(router);
app.use(ToastService) app.use(ToastService)
const deckService: DeckService = new DeckService(undefined, config.API_BASE_URL, axiosInstance) const deckService: DeckService = new DeckService(undefined, "/api", axiosInstance)
const cardService: CardService = new CardService(undefined, config.API_BASE_URL, axiosInstance) const cardService: CardService = new CardService(undefined, "/api", axiosInstance)
const setService: SetService = new SetService(undefined, config.API_BASE_URL, axiosInstance) const setService: SetService = new SetService(undefined, "/api", axiosInstance)
const cardPrintService: CardPrintService = new CardPrintService(undefined, config.API_BASE_URL, axiosInstance) const cardPrintService: CardPrintService = new CardPrintService(undefined, "/api", axiosInstance)
const jobService: JobService = new JobService(undefined, config.API_BASE_URL, axiosInstance) const jobService: JobService = new JobService(undefined, "/api", axiosInstance)
app.provide(DeckServiceKey, deckService) app.provide(DeckServiceKey, deckService)
app.provide(CardServiceKey, cardService) app.provide(CardServiceKey, cardService)

View File

@@ -24,6 +24,16 @@ export default defineConfig({
'@': path.resolve(__dirname, './src'), '@': path.resolve(__dirname, './src'),
} }
}, },
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
build: { build: {
// @ts-ignore // @ts-ignore
assetsInclude: [ assetsInclude: [