From 962067e824a28ae11eef5ace3428c555f0f5d8c2 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 2 Nov 2024 22:43:27 +0100 Subject: [PATCH] fix: :zap: add api url configurable --- eslint.config.js | 9 ++++++--- frontend/App.vue | 4 ++-- {public => frontend/assets}/favicon.ico | Bin frontend/main.ts | 5 ++++- frontend/router/index.ts | 4 ++-- frontend/views/Containers.vue | 4 ++-- index.html | 2 +- vite.config.ts | 12 +++++------- 8 files changed, 22 insertions(+), 18 deletions(-) rename {public => frontend/assets}/favicon.ico (100%) diff --git a/eslint.config.js b/eslint.config.js index a7f3858..6fb4ba3 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -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', - } - } + }, + }, ] diff --git a/frontend/App.vue b/frontend/App.vue index 511f6f5..cb17028 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -7,7 +7,7 @@ import { RouterView } from 'vue-router' export default { components: { - RouterView - } + RouterView, + }, } diff --git a/public/favicon.ico b/frontend/assets/favicon.ico similarity index 100% rename from public/favicon.ico rename to frontend/assets/favicon.ico diff --git a/frontend/main.ts b/frontend/main.ts index efe493a..e887f84 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -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') diff --git a/frontend/router/index.ts b/frontend/router/index.ts index 8f6c25a..328b00f 100644 --- a/frontend/router/index.ts +++ b/frontend/router/index.ts @@ -7,9 +7,9 @@ const router = createRouter({ { path: '/', name: 'home', - component: Containers + component: Containers, }, - ] + ], }) export default router diff --git a/frontend/views/Containers.vue b/frontend/views/Containers.vue index bf4e689..09d3fe7 100644 --- a/frontend/views/Containers.vue +++ b/frontend/views/Containers.vue @@ -1,9 +1,9 @@ diff --git a/index.html b/index.html index 59e287d..81007ef 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + Pilotwings diff --git a/vite.config.ts b/vite.config.ts index 775c85a..6c25174 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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', }, })