2 Commits

Author SHA1 Message Date
Roland Schneider
9dc426bf64 [yoga-4] add article to single service 2025-05-20 16:56:38 +02:00
Roland Schneider
2c71984d96 [yoga-4] add dynamic service page 2025-05-20 16:55:25 +02:00
6 changed files with 67 additions and 7 deletions

View File

@@ -22,3 +22,8 @@ x
GET {{domain}}/api/yoga-blog-posts/wmhqy1n8japcfpy0of4hauwm GET {{domain}}/api/yoga-blog-posts/wmhqy1n8japcfpy0of4hauwm
Accept: application/json Accept: application/json
#Authorization: Bearer {{token}} #Authorization: Bearer {{token}}
### GET request with a header
GET {{domain}}/api/yoga-single-services?filters[name][$eq]=service4
Accept: application/json

View File

@@ -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 {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-page";
import {FaqPage_Plain} from "@/types/generated-strapi-interfaces/api/faq-page"; import {FaqPage_Plain} from "@/types/generated-strapi-interfaces/api/faq-page";
import {ContactPage_Plain} from "@/types/generated-strapi-interfaces/api/contact-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{ class StrapiApi{
@@ -42,6 +43,16 @@ class StrapiApi{
return this.getJson("/api/services-page?",servicesQuery); return this.getJson("/api/services-page?",servicesQuery);
} }
public getServicePage(name: string): Promise<YogaSingleService_Plain[]>{
return this.getJson("/api/yoga-single-services?", {
filters: {
name: {
$eq: name,
},
},
});
}
public getPricesPage(): Promise<PricesPage_Plain>{ public getPricesPage(): Promise<PricesPage_Plain>{
return this.getJson("/api/prices-page?",pricesQuery); return this.getJson("/api/prices-page?",pricesQuery);
} }

View File

@@ -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 && <SubHeaderComponent header1={header} description={description} />}
// { ourServices && <OurServicesComponent config={ourServices} /> }
// { contactUs && <ContactUsComponent contactUs={contactUs} />}
// { ourSpecialities && <OurSpecialitiesComponent config={ourSpecialities} /> }
// { feedbacks && <FeedbackComponent config={feedbacks} /> }
// { blogs && <BlogPostsComponent config={blogs} /> }
// { subscribe && <SubscribeComponent config={subscribe} /> }
// { footer && <FooterComponent config={footer} /> }
// <AosComponent />
// </>
// );
console.info("slug", params.slug);
console.info("servicesByName", servicesByName);
return (
<div>hello world {params.slug}</div>
);
}
export const dynamic = 'force-dynamic'

View File

@@ -13,6 +13,7 @@ export interface YogaSingleService {
image?: { data: Media }; image?: { data: Media };
imageAlt?: string; imageAlt?: string;
name?: string; name?: string;
article?: string;
locale: string; locale: string;
localizations?: { data: YogaSingleService[] }; localizations?: { data: YogaSingleService[] };
}; };
@@ -25,6 +26,7 @@ export interface YogaSingleService_Plain {
image?: Media_Plain; image?: Media_Plain;
imageAlt?: string; imageAlt?: string;
name?: string; name?: string;
article?: string;
locale: string; locale: string;
localizations?: YogaSingleService_Plain[]; localizations?: YogaSingleService_Plain[];
} }
@@ -37,6 +39,7 @@ export interface YogaSingleService_NoRelations {
image?: number; image?: number;
imageAlt?: string; imageAlt?: string;
name?: string; name?: string;
article?: string;
locale: string; locale: string;
localizations?: YogaSingleService[]; localizations?: YogaSingleService[];
} }
@@ -49,6 +52,7 @@ export interface YogaSingleService_AdminPanelLifeCycle {
image?: AdminPanelRelationPropertyModification<Media_Plain>; image?: AdminPanelRelationPropertyModification<Media_Plain>;
imageAlt?: string; imageAlt?: string;
name?: string; name?: string;
article?: string;
locale: string; locale: string;
localizations?: YogaSingleService[]; localizations?: YogaSingleService[];
} }

View File

@@ -4,7 +4,8 @@
"info": { "info": {
"singularName": "yoga-single-service", "singularName": "yoga-single-service",
"pluralName": "yoga-single-services", "pluralName": "yoga-single-services",
"displayName": "YogaSingleService" "displayName": "YogaSingleService",
"description": ""
}, },
"options": { "options": {
"draftAndPublish": true "draftAndPublish": true
@@ -40,14 +41,15 @@
"type": "string" "type": "string"
}, },
"image": { "image": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [ "allowedTypes": [
"images", "images",
"files", "files",
"videos", "videos",
"audios" "audios"
], ],
"type": "media",
"multiple": false,
"pluginOptions": { "pluginOptions": {
"i18n": { "i18n": {
"localized": true "localized": true
@@ -69,6 +71,14 @@
} }
}, },
"type": "string" "type": "string"
},
"article": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "richtext"
} }
} }
} }

View File

@@ -34,10 +34,6 @@ export interface AdminApiToken extends Struct.CollectionTypeSchema {
minLength: 1; minLength: 1;
}> & }> &
Schema.Attribute.DefaultTo<''>; Schema.Attribute.DefaultTo<''>;
encryptedKey: Schema.Attribute.Text &
Schema.Attribute.SetMinMaxLength<{
minLength: 1;
}>;
expiresAt: Schema.Attribute.DateTime; expiresAt: Schema.Attribute.DateTime;
lastUsedAt: Schema.Attribute.DateTime; lastUsedAt: Schema.Attribute.DateTime;
lifespan: Schema.Attribute.BigInteger; lifespan: Schema.Attribute.BigInteger;
@@ -1677,6 +1673,7 @@ export interface ApiYogaSingleServiceYogaSingleService
extends Struct.CollectionTypeSchema { extends Struct.CollectionTypeSchema {
collectionName: 'yoga_single_services'; collectionName: 'yoga_single_services';
info: { info: {
description: '';
displayName: 'YogaSingleService'; displayName: 'YogaSingleService';
pluralName: 'yoga-single-services'; pluralName: 'yoga-single-services';
singularName: 'yoga-single-service'; singularName: 'yoga-single-service';
@@ -1690,6 +1687,12 @@ export interface ApiYogaSingleServiceYogaSingleService
}; };
}; };
attributes: { attributes: {
article: Schema.Attribute.RichText &
Schema.Attribute.SetPluginOptions<{
i18n: {
localized: true;
};
}>;
buttonLink: Schema.Attribute.String & buttonLink: Schema.Attribute.String &
Schema.Attribute.SetPluginOptions<{ Schema.Attribute.SetPluginOptions<{
i18n: { i18n: {