From 51551f0aa7fa5d9084956eef8428bc529c7513e6 Mon Sep 17 00:00:00 2001 From: Georg Spar Date: Wed, 28 Jun 2023 22:05:21 +0200 Subject: [PATCH] =?UTF-8?q?test=20f=C3=BCr=20runtime=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Bought.vue | 12 +++++++----- components/Evaluated.vue | 2 +- nuxt.config.ts | 5 +++++ todo.md | 1 - 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/Bought.vue b/components/Bought.vue index 1c48dd8..3b76e68 100644 --- a/components/Bought.vue +++ b/components/Bought.vue @@ -87,6 +87,8 @@ import { useDialog } from "primevue/usedialog"; import UpdPhoto from "./UpdPhoto.vue"; import Upditemext from "./Upditemext.vue"; +const config = useRuntimeConfig(); +console.log (config.public.apiHostname); interface cItemB { id: number; @@ -107,7 +109,7 @@ let imgurl = ref(); const imgref = ref(); //imgref.value='1679468897186c75b5379eb6691871da30ef18b98a_1.jpg'; const {data: itemsb } = await awaitItemsb(); -const {data: typen } = await useFetch('http://ubodroid-2:8081/api/v1/typ'); +const {data: typen } = await useFetch(config.public.apiHostname + 'api/v1/typ'); async function openDetail(id) { await navigateTo({ @@ -122,7 +124,7 @@ async function openDetail(id) { }; async function awaitItemsb() { - const res = await useFetch('http://ubodroid-2:8081/api/v1/itb'); + const res = await useFetch(config.public.apiHostname + 'api/v1/itb'); let r: any; @@ -144,7 +146,7 @@ async function openEval(id: number) { } async function openFrontview(iid: number) { - const itemb = await useFetch('http://ubodroid-2:8081/api/v1/itb/'+iid); + const itemb = await useFetch(config.public.apiHostname + 'api/v1/itb/'+iid); let itb: cItemB; console.log(itemb.data.value); itb = itemb.data.value; @@ -175,7 +177,7 @@ async function doUpdate(t: cItemB) { fd.append('abmessungenid', t.abmessungen.id.toString()); fd.append('frontviewid', t.frontviewid.toString()); console.log('fd = ', fd); - await $fetch('http://ubodroid-2:8081/api/v1/itb/'+t.id,{ + await $fetch(config.public.apiHostname + 'api/v1/itb/'+t.id,{ method: 'PUT', body: fd }); @@ -205,7 +207,7 @@ const onNew = () => { fd.append('abmessungenid', t.abmessungenid.toString()); fd.append('frontviewid', t.frontviewid.toString()); console.log('fd = ', fd); - await $fetch('http://ubodroid-2:8081/api/v1/itb',{ + await $fetch(config.public.apiHostname + 'api/v1/itb',{ method: 'POST', body: fd }); diff --git a/components/Evaluated.vue b/components/Evaluated.vue index c03651f..73ccac9 100644 --- a/components/Evaluated.vue +++ b/components/Evaluated.vue @@ -13,7 +13,7 @@
-
{{ slotProps.data.itemb.kurzbeschreibung }}
+
{{ slotProps.data.genehmigt }}
diff --git a/nuxt.config.ts b/nuxt.config.ts index 72c5984..fe60992 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -11,4 +11,9 @@ export default defineNuxtConfig({ build: { transpile: ['primevue'] }, + runtimeConfig:{ + public: { + apiHostname: '' + } + } }) diff --git a/todo.md b/todo.md index 328533e..918ad6a 100644 --- a/todo.md +++ b/todo.md @@ -1,4 +1,3 @@ * Feld frontview bei itemb und itemext einführen * Ergänzung der API um die Felder, die für die Detailbetrachtung und das Speichern notwendig sind * localhost anstelle des Rechnernamens vor dem Container-Test einfügen -* \ No newline at end of file