From 3e260c00076de8c5fa68813d136e5a12f3a846e9 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Tue, 5 Nov 2024 18:31:12 +0100 Subject: [PATCH] api url and environment --- components/CollectionDetail.vue | 3 ++- components/Header.vue | 3 ++- components/base/ListImageItem.vue | 3 ++- components/dynamicZone/ColumnImageText.vue | 3 ++- components/dynamicZone/FullImage.vue | 3 ++- components/dynamicZone/Gallery.vue | 3 ++- components/shared/Hero.vue | 3 ++- components/shared/List.vue | 8 ++++++-- layouts/landing.vue | 5 +++-- nuxt.config.ts | 17 +++++++++++++++++ 10 files changed, 40 insertions(+), 11 deletions(-) diff --git a/components/CollectionDetail.vue b/components/CollectionDetail.vue index c58b008..5b77f19 100644 --- a/components/CollectionDetail.vue +++ b/components/CollectionDetail.vue @@ -50,7 +50,8 @@ import type Operation from "../types/collection/operation"; import type Event from "../types/collection/event"; import type Vehicle from "../types/collection/vehicle"; -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; defineProps({ data: Object as PropType
, diff --git a/components/Header.vue b/components/Header.vue index 7b40d72..3932d4f 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -66,7 +66,8 @@ import type Global from "../types/single/global"; const { params: { slug: params }, } = useRoute(); -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; const { findOne } = useStrapi(); const { data: global } = await useAsyncData("global", () => findOne("global")); diff --git a/components/base/ListImageItem.vue b/components/base/ListImageItem.vue index 96ae710..a797fc4 100644 --- a/components/base/ListImageItem.vue +++ b/components/base/ListImageItem.vue @@ -36,7 +36,8 @@ import type { PropType } from "vue"; import type BaseCollection from "~/types/collection/baseCollection"; -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; defineProps({ data: Object as PropType, diff --git a/components/dynamicZone/ColumnImageText.vue b/components/dynamicZone/ColumnImageText.vue index 99b8ca4..8cdedab 100644 --- a/components/dynamicZone/ColumnImageText.vue +++ b/components/dynamicZone/ColumnImageText.vue @@ -15,7 +15,8 @@ import type { PropType } from "vue"; import type DynamicZoneColumnImageText from "../../types/component/dynamicZoneColumnImageText"; -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; defineProps({ data: Object as PropType, diff --git a/components/dynamicZone/FullImage.vue b/components/dynamicZone/FullImage.vue index 812dc2a..1d47865 100644 --- a/components/dynamicZone/FullImage.vue +++ b/components/dynamicZone/FullImage.vue @@ -11,7 +11,8 @@ import type { PropType } from "vue"; import type DynamicZoneFullImage from "../../types/component/dynamicZoneFullImage"; -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; defineProps({ data: Object as PropType, diff --git a/components/dynamicZone/Gallery.vue b/components/dynamicZone/Gallery.vue index 2e54a84..d05e9b2 100644 --- a/components/dynamicZone/Gallery.vue +++ b/components/dynamicZone/Gallery.vue @@ -14,7 +14,8 @@ import type { PropType } from "vue"; import type DynamicZoneGallery from "../../types/component/dynamicZoneGallery"; -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; defineProps({ data: Object as PropType, diff --git a/components/shared/Hero.vue b/components/shared/Hero.vue index 68fd67b..fba797b 100644 --- a/components/shared/Hero.vue +++ b/components/shared/Hero.vue @@ -20,5 +20,6 @@ defineProps({ data: Object as PropType, }); -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; diff --git a/components/shared/List.vue b/components/shared/List.vue index 1c05a07..b183c3c 100644 --- a/components/shared/List.vue +++ b/components/shared/List.vue @@ -32,7 +32,10 @@ /> -
+

Elemente {{ showingText }} von {{ entryCount }} @@ -87,7 +90,8 @@ interface Meta { total: number; } -const baseUrl = useStrapiUrl().replace("/api", ""); +const runtimeConfig = useRuntimeConfig(); +const baseUrl = runtimeConfig.public.strapi.url; const { find } = useStrapi(); const props = defineProps({ diff --git a/layouts/landing.vue b/layouts/landing.vue index 431a807..7605dab 100644 --- a/layouts/landing.vue +++ b/layouts/landing.vue @@ -1,5 +1,5 @@