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

View File

@ -7,7 +7,7 @@ import { RouterView } from 'vue-router'
export default { export default {
components: { components: {
RouterView RouterView,
} },
} }
</script> </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 App from './App.vue'
import { createApp } from 'vue'
import router from './router' import router from './router'
const app = createApp(App) 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.use(router)
app.mount('#app') app.mount('#app')

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <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"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pilotwings</title> <title>Pilotwings</title>
</head> </head>

View File

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