api url and environment

This commit is contained in:
Julian Krauser 2024-11-05 18:31:12 +01:00
parent 38385d56d9
commit 3e260c0007
10 changed files with 40 additions and 11 deletions

View file

@ -50,7 +50,8 @@ import type Operation from "../types/collection/operation";
import type Event from "../types/collection/event"; import type Event from "../types/collection/event";
import type Vehicle from "../types/collection/vehicle"; import type Vehicle from "../types/collection/vehicle";
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
defineProps({ defineProps({
data: Object as PropType<Article | Operation | Event | Vehicle>, data: Object as PropType<Article | Operation | Event | Vehicle>,

View file

@ -66,7 +66,8 @@ import type Global from "../types/single/global";
const { const {
params: { slug: params }, params: { slug: params },
} = useRoute(); } = useRoute();
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
const { findOne } = useStrapi(); const { findOne } = useStrapi();
const { data: global } = await useAsyncData("global", () => findOne<Global>("global")); const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));

View file

@ -36,7 +36,8 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import type BaseCollection from "~/types/collection/baseCollection"; import type BaseCollection from "~/types/collection/baseCollection";
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
defineProps({ defineProps({
data: Object as PropType<BaseCollection>, data: Object as PropType<BaseCollection>,

View file

@ -15,7 +15,8 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import type DynamicZoneColumnImageText from "../../types/component/dynamicZoneColumnImageText"; import type DynamicZoneColumnImageText from "../../types/component/dynamicZoneColumnImageText";
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
defineProps({ defineProps({
data: Object as PropType<DynamicZoneColumnImageText>, data: Object as PropType<DynamicZoneColumnImageText>,

View file

@ -11,7 +11,8 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import type DynamicZoneFullImage from "../../types/component/dynamicZoneFullImage"; import type DynamicZoneFullImage from "../../types/component/dynamicZoneFullImage";
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
defineProps({ defineProps({
data: Object as PropType<DynamicZoneFullImage>, data: Object as PropType<DynamicZoneFullImage>,

View file

@ -14,7 +14,8 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import type DynamicZoneGallery from "../../types/component/dynamicZoneGallery"; import type DynamicZoneGallery from "../../types/component/dynamicZoneGallery";
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
defineProps({ defineProps({
data: Object as PropType<DynamicZoneGallery>, data: Object as PropType<DynamicZoneGallery>,

View file

@ -20,5 +20,6 @@ defineProps({
data: Object as PropType<SharedHero>, data: Object as PropType<SharedHero>,
}); });
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
</script> </script>

View file

@ -32,7 +32,10 @@
/> />
</div> </div>
</div> </div>
<div v-if="data?.lookup.date_list" class="flex flex-row w-full justify-between items-center select-none pt-4"> <div
v-if="data?.lookup.date_list"
class="flex flex-row w-full max-w-4xl mx-auto justify-between items-center select-none pt-4"
>
<p class="text-sm font-normal text-gray-500"> <p class="text-sm font-normal text-gray-500">
Elemente <span class="font-semibold text-gray-900">{{ showingText }}</span> von Elemente <span class="font-semibold text-gray-900">{{ showingText }}</span> von
<span class="font-semibold text-gray-900">{{ entryCount }}</span> <span class="font-semibold text-gray-900">{{ entryCount }}</span>
@ -87,7 +90,8 @@ interface Meta {
total: number; total: number;
} }
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
const { find } = useStrapi(); const { find } = useStrapi();
const props = defineProps({ const props = defineProps({

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="relative h-[calc(100vh-6rem)] max-h-[calc(100vh-6rem)] w-full overflow-hidden"> <div class="relative h-[calc(100svh-6rem)] max-h-[calc(100svh-6rem)] w-full overflow-hidden">
<NuxtPicture <NuxtPicture
loading="lazy" loading="lazy"
class="w-full h-full object-cover object-center" class="w-full h-full object-cover object-center"
@ -20,7 +20,8 @@ import type Homepage from "../types/single/homepage";
const { const {
params: { slug: params }, params: { slug: params },
} = useRoute(); } = useRoute();
const baseUrl = useStrapiUrl().replace("/api", ""); const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
const { findOne } = useStrapi(); const { findOne } = useStrapi();
const { data: global } = await useAsyncData("global", () => findOne<Global>("global")); const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));

View file

@ -35,4 +35,21 @@ export default defineNuxtConfig({
prefix: "/api", prefix: "/api",
version: "v5", version: "v5",
}, },
runtimeConfig: {
strapi: {
url: process.env.STRAPI_URL ?? "localhost:1337",
},
app: {
title: process.env.APP_TITLE ?? "Feuerwehr",
},
public: {
strapi: {
url: process.env.STRAPI_URL ?? "localhost:1337",
},
app: {
title: process.env.APP_TITLE ?? "Feuerwehr",
},
},
},
}); });