Skip to content

Commit

Permalink
#hotfix: [SXA] fixed background-image
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-ruslanmatkovskyi committed Jul 18, 2022
1 parent be1428c commit fb7a4ff
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Placeholder,
useSitecoreContext,
} from '@sitecore-jss/sitecore-jss-nextjs';
import config from 'temp/config';

const BACKGROUND_REG_EXP = new RegExp(
/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi
Expand All @@ -25,13 +26,12 @@ const Container = (props: ComponentProps): JSX.Element => {

if (backgroundImage) {
const prefix = `${sitecoreContext.pageState !== 'normal' ? '/sitecore/shell' : ''}/-/media/`;
backgroundImage = `${backgroundImage
?.match(BACKGROUND_REG_EXP)
?.pop()
?.replace(/-/gi, '')}`;
backgroundImage = `${backgroundImage?.match(BACKGROUND_REG_EXP)?.pop()?.replace(/-/gi, '')}`;

// TODO: here uses ${config.sitecoreApiHost} it's temporary solutions - it will be removed when be fix bug - UNABLE_TO_VERIFY_LEAF_SIGNATUE
// TODO: this fix https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/walkthrough--configuring-sitecore-ca-certificates-for-node-js.html doesn't help
backgroundStyle = {
backgroundImage: `url('${prefix}${backgroundImage}')`,
backgroundImage: `url('${config.sitecoreApiHost}${prefix}${backgroundImage}')`,
};
}

Expand Down

0 comments on commit fb7a4ff

Please sign in to comment.