fix: add api url configurable

This commit is contained in:
Michel Roux 2024-11-02 22:43:27 +01:00
parent 44dfe145ed
commit 962067e824
8 changed files with 22 additions and 18 deletions

View File

@ -1,6 +1,7 @@
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
export default [
{
@ -16,10 +17,12 @@ export default [
...pluginVue.configs['flat/recommended'],
...vueTsEslintConfig(),
skipFormatting,
eslintPluginPrettierRecommended,
{
rules: {
'sort-imports': 'error',
'vue/multi-word-component-names': 'off',
}
}
},
},
]

View File

@ -7,7 +7,7 @@ import { RouterView } from 'vue-router'
export default {
components: {
RouterView
}
RouterView,
},
}
</script>

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,7 +1,10 @@
import { createApp } from 'vue'
import App from './App.vue'
import { createApp } from 'vue'
import router from './router'
const app = createApp(App)
app.config.globalProperties.$api = import.meta.env.PROD
? `${import.meta.env.BASE_URL}api`
: `http://localhost:${import.meta.env.API_PORT ?? 5000}/api`
app.use(router)
app.mount('#app')

View File

@ -7,9 +7,9 @@ const router = createRouter({
{
path: '/',
name: 'home',
component: Containers
component: Containers,
},
]
],
})
export default router

View File

@ -4,6 +4,6 @@
<script lang="ts">
export default {
name: 'Containers'
name: 'Containers',
}
</script>

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<link rel="icon" href="/frontend/assets/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pilotwings</title>
</head>

View File

@ -1,19 +1,17 @@
import { fileURLToPath, URL } from 'node:url'
import { URL, fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
],
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./frontend', import.meta.url))
}
'@': fileURLToPath(new URL('./frontend', import.meta.url)),
},
},
build: {
outDir: 'backend/dist'
outDir: 'backend/dist',
},
})