From dcd38feee66224bd1dfbb4d0e3a4f96cd10563ae Mon Sep 17 00:00:00 2001 From: SitecoreAdmin Date: Thu, 17 Aug 2023 07:39:06 +0000 Subject: [PATCH] Updated Apollo client graphql endpoint - Added endpoint to fecth result from Delivery API endpoint --- .../src/components/Espire/Listing/Listing.tsx | 2 +- .../src/lib/graphql/graphql-apollo-client.ts | 10 +++++----- src/sxastarter/src/lib/middleware/smallcase-url.ts | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sxastarter/src/components/Espire/Listing/Listing.tsx b/src/sxastarter/src/components/Espire/Listing/Listing.tsx index 8d20a07a3..35bd33ebf 100644 --- a/src/sxastarter/src/components/Espire/Listing/Listing.tsx +++ b/src/sxastarter/src/components/Espire/Listing/Listing.tsx @@ -23,7 +23,7 @@ export const Listing = (props: ListingProps): JSX.Element => { const { sitecoreContext } = useSitecoreContext(); const scope = props?.params?.Scope; const language = sitecoreContext?.language; - const count = props?.params?.['Display Count']; + const count = props?.params?.['Display Count'] ? props?.params?.['Display Count'] : 5; const GetList = async (): Promise => { const { data } = await apolloClient.query({ diff --git a/src/sxastarter/src/lib/graphql/graphql-apollo-client.ts b/src/sxastarter/src/lib/graphql/graphql-apollo-client.ts index d51ecd5fa..bdd6be36f 100644 --- a/src/sxastarter/src/lib/graphql/graphql-apollo-client.ts +++ b/src/sxastarter/src/lib/graphql/graphql-apollo-client.ts @@ -1,12 +1,12 @@ import { ApolloClient, InMemoryCache } from '@apollo/client'; -import config from 'temp/config'; - export const apolloClient = new ApolloClient({ - uri: `${config.sitecoreApiHost}/sitecore/api/graph/edge`, + uri: `https://edge.sitecorecloud.io/api/graphql/v1`, cache: new InMemoryCache({}), headers: { 'Content-Type': 'application/json', - Authorization: config.sitecoreApiKey, - sc_apikey: config.sitecoreApiKey, + Authorization: + 'dXBvekgxNmJPL1JsWGg2S2RkV1Z2bnA0MnZNcHR6QTlIZ09oa0g4cDlhUT18ZXNwaXJlaW5mb2wzOTkzLWVzcGlyZXN0YXJ0ZWYwNi1kZXYtNjJhYQ==', + sc_apikey: + 'dXBvekgxNmJPL1JsWGg2S2RkV1Z2bnA0MnZNcHR6QTlIZ09oa0g4cDlhUT18ZXNwaXJlaW5mb2wzOTkzLWVzcGlyZXN0YXJ0ZWYwNi1kZXYtNjJhYQ==', }, }); diff --git a/src/sxastarter/src/lib/middleware/smallcase-url.ts b/src/sxastarter/src/lib/middleware/smallcase-url.ts index 052e127a5..d09055cb6 100644 --- a/src/sxastarter/src/lib/middleware/smallcase-url.ts +++ b/src/sxastarter/src/lib/middleware/smallcase-url.ts @@ -3,7 +3,6 @@ import { NextResponse } from 'next/server'; export function smallcaseurl(req: NextRequest): NextResponse { const { pathname, origin } = req.nextUrl; - console.log(req, 'Rehmo'); if (pathname === pathname.toLowerCase()) { return NextResponse.next(); }