Skip to content

Commit

Permalink
Merge pull request #294 from summit-webapp/release-v1.1.1
Browse files Browse the repository at this point in the history
Release v1.1.1
  • Loading branch information
karan1633 authored Nov 15, 2024
2 parents a1dbb47 + 9b8bf54 commit f15a395
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions pages/brand-product/[category-slug]/[productId]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import PageMetaData from '../../../../components/PageMetaData';
import ProductPageMaster from '../../../../components/ProductPageComponents/ProductPageMaster';
import { MetaDataTypes } from '../../../../interfaces/meta-data-interface';
import MetaTag from '../../../../services/api/general-apis/meta-tag-api';
import { CONSTANTS } from '../../../../services/config/app-config';

const Index = ({ metaData }: MetaDataTypes) => {
return (
<>
{CONSTANTS.ENABLE_META_TAGS && <PageMetaData meta_data={metaData} />}
<>
<ProductPageMaster />
</>
</>
);
};

export async function getServerSideProps(context: any) {
const { SUMMIT_APP_CONFIG } = CONSTANTS;
const method = 'get_meta_tags';
const version = SUMMIT_APP_CONFIG.version;
const entity = 'seo';
const params = `?version=${version}&method=${method}&entity=${entity}`;
const url = `${context.resolvedUrl.split('?')[0]}`;
if (CONSTANTS.ENABLE_META_TAGS) {
let metaDataFromAPI: any = await MetaTag(`${CONSTANTS.API_BASE_URL}${SUMMIT_APP_CONFIG.app_name}${params}&page_name=${url}`);
if (
metaDataFromAPI.status === 200 &&
metaDataFromAPI?.data?.message?.msg === 'success' &&
metaDataFromAPI?.data?.message?.data !== 'null'
) {
const metaData = metaDataFromAPI?.data?.message?.data;
return { props: { metaData } };
}
} else {
return {
props: {},
};
}
}
export default Index;

0 comments on commit f15a395

Please sign in to comment.