Skip to content

Commit

Permalink
[nextjs-sxa] hotfix eslint for building nextjs-sxa (#1046)
Browse files Browse the repository at this point in the history
* hotfix eslint for building nextjs-sxa

* hotfix eslint for building nextjs-sxa

* #hotfix fixed lint errors
  • Loading branch information
sc-ruslanmatkovskyi authored May 31, 2022
1 parent eb2c990 commit 962bf7a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Container = (props: ComponentProps): JSX.Element => {
const styles = `${props.params.GridParameters} ${props.params.Styles}`.trimEnd();
const phKey = `container-${props.params.DynamicPlaceholderId}`;
const backgroundImage = props.params.BackgroundImage as string;
let backgroundStyle: { [key: string]: string };
let backgroundStyle: { [key: string]: string } = { backgroundImage: ''};

if (backgroundImage) {
const prefix = `${sitecoreContext.pageState !== 'normal' ? '/sitecore/shell' : ''}/-/media/`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ export const Default = (props: PageContentProps): JSX.Element => {
);
}

const field =
const field = (
props.fields && props.fields.Content
? props.fields.Content
: sitecoreContext?.route?.fields?.Content;
: sitecoreContext?.route?.fields?.Content
) as RichTextField;

return (
<ComponentContent styles={props.params.styles}>
<JssRichText field={field} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { Placeholder } from '@sitecore-jss/sitecore-jss-nextjs';
import { ComponentRendering, RouteData } from '@sitecore-jss/sitecore-jss/layout';
import { Placeholder, ComponentRendering } from '@sitecore-jss/sitecore-jss-nextjs';

type DynamicPlaceholderProps = {
rendering: ComponentRendering | RouteData;
rendering: ComponentRendering;
};

const PartialDesignDynamicPlaceholder = (props: DynamicPlaceholderProps): JSX.Element => (
<Placeholder name={props.rendering.params.sig} rendering={props.rendering} />
<Placeholder name={props.rendering?.params?.sig || ''} rendering={props.rendering} />
);

export default PartialDesignDynamicPlaceholder;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { AxiosDataFetcher, GraphQLSitemapXmlService } from '@sitecore-jss/siteco
const ABSOLUTE_URL_REGEXP = '^(?:[a-z]+:)?//';

const sitemapApi = async (req: NextApiRequest, res: NextApiResponse): Promise<NextApiResponse | void> => {
const { query: { id } } = req;
const {
query: { id },
} = req;
// create sitemap graphql service
const sitemapXmlService = new GraphQLSitemapXmlService({
endpoint: config.graphQLEndpoint,
Expand All @@ -21,13 +23,14 @@ const sitemapApi = async (req: NextApiRequest, res: NextApiResponse): Promise<Ne
const sitemapUrl = isAbsoluteUrl ? sitemapPath : `${config.sitecoreApiHost}${sitemapPath}`;
res.setHeader('Content-Type', 'text/xml;charset=utf-8');

return new AxiosDataFetcher().get(sitemapUrl, {
responseType: 'stream',
})
.then((response: AxiosResponse) => {
response.data.pipe(res);
})
.catch(() => res.redirect('/404'));
return new AxiosDataFetcher()
.get(sitemapUrl, {
responseType: 'stream',
})
.then((response: AxiosResponse) => {
response.data.pipe(res);
})
.catch(() => res.redirect('/404'));
}

res.redirect('/404');
Expand Down

0 comments on commit 962bf7a

Please sign in to comment.