From 2c71984d9614812878c182ac3d753be27b6a1917 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 20 May 2025 16:55:25 +0200 Subject: [PATCH] [yoga-4] add dynamic service page --- api.http | 5 ++++ yoga-app/src/api/strapi/strapi-api.ts | 11 +++++++++ yoga-app/src/app/services/[slug]/page.tsx | 27 ++++++++++++++++++++++ yoga-cms/types/generated/contentTypes.d.ts | 4 ---- 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 yoga-app/src/app/services/[slug]/page.tsx diff --git a/api.http b/api.http index 449cad0..177f818 100644 --- a/api.http +++ b/api.http @@ -22,3 +22,8 @@ x GET {{domain}}/api/yoga-blog-posts/wmhqy1n8japcfpy0of4hauwm Accept: application/json #Authorization: Bearer {{token}} + + +### GET request with a header +GET {{domain}}/api/yoga-single-services?filters[name][$eq]=service4 +Accept: application/json \ No newline at end of file diff --git a/yoga-app/src/api/strapi/strapi-api.ts b/yoga-app/src/api/strapi/strapi-api.ts index 5aa91b6..4208309 100644 --- a/yoga-app/src/api/strapi/strapi-api.ts +++ b/yoga-app/src/api/strapi/strapi-api.ts @@ -13,6 +13,7 @@ import {ServicesPage_Plain} from "@/types/generated-strapi-interfaces/api/servic import {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-page"; import {FaqPage_Plain} from "@/types/generated-strapi-interfaces/api/faq-page"; import {ContactPage_Plain} from "@/types/generated-strapi-interfaces/api/contact-page"; +import {YogaSingleService_Plain} from "@/types/generated-strapi-interfaces/api/yoga-single-service"; class StrapiApi{ @@ -42,6 +43,16 @@ class StrapiApi{ return this.getJson("/api/services-page?",servicesQuery); } + public getServicePage(name: string): Promise{ + return this.getJson("/api/yoga-single-services?", { + filters: { + name: { + $eq: name, + }, + }, + }); + } + public getPricesPage(): Promise{ return this.getJson("/api/prices-page?",pricesQuery); } diff --git a/yoga-app/src/app/services/[slug]/page.tsx b/yoga-app/src/app/services/[slug]/page.tsx new file mode 100644 index 0000000..c28afa2 --- /dev/null +++ b/yoga-app/src/app/services/[slug]/page.tsx @@ -0,0 +1,27 @@ +import React from "react"; +import strapiApi from "@/api/strapi/strapi-api"; +export default async function ServiceArticlePage({params}: { + params: { slug: string} +} ) { + const servicesByName = await strapiApi.getServicePage(params.slug); + // return ( + // <> + // {header && description && } + // { ourServices && } + // { contactUs && } + // { ourSpecialities && } + // { feedbacks && } + // { blogs && } + // { subscribe && } + // { footer && } + // + // + // ); + console.info("slug", params.slug); + console.info("servicesByName", servicesByName); + return ( +
hello world {params.slug}
+ ); +} + +export const dynamic = 'force-dynamic' diff --git a/yoga-cms/types/generated/contentTypes.d.ts b/yoga-cms/types/generated/contentTypes.d.ts index e8a1138..e8442da 100644 --- a/yoga-cms/types/generated/contentTypes.d.ts +++ b/yoga-cms/types/generated/contentTypes.d.ts @@ -34,10 +34,6 @@ export interface AdminApiToken extends Struct.CollectionTypeSchema { minLength: 1; }> & Schema.Attribute.DefaultTo<''>; - encryptedKey: Schema.Attribute.Text & - Schema.Attribute.SetMinMaxLength<{ - minLength: 1; - }>; expiresAt: Schema.Attribute.DateTime; lastUsedAt: Schema.Attribute.DateTime; lifespan: Schema.Attribute.BigInteger;