-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from summit-webapp/release-v1.1.1
Release v1.1.1
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |