Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename siteAliasOrIdRef to site #717

Merged
merged 2 commits into from
Sep 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/template-retail-react-app/app/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ export const getPathWithLocale = (shortCode, buildUrl, opts = {}) => {
})
}

const siteAliasOrIdRef = getSiteByReference(siteRef)
const site = getSiteByReference(siteRef)

const locale = getLocaleByReference(siteAliasOrIdRef, shortCode)
const locale = getLocaleByReference(site, shortCode)

// rebuild the url with new locale,
const newUrl = buildUrl(
Expand All @@ -185,11 +185,8 @@ export const getPathWithLocale = (shortCode, buildUrl, opts = {}) => {
export const createUrlTemplate = (appConfig, siteRef, localeRef) => {
const {site: siteConfig, locale: localeConfig, showDefaults: showDefaultsConfig} = appConfig.url
const defaultSite = getDefaultSite()
const siteAliasOrIdRef = getSiteByReference(siteRef)
const defaultLocale = getLocaleByReference(
siteAliasOrIdRef,
siteAliasOrIdRef.l10n.defaultLocale
)
const site = getSiteByReference(siteRef)
const defaultLocale = getLocaleByReference(site, site.l10n.defaultLocale)

const isDefaultSite =
defaultSite.id === siteRef || (defaultSite.alias && defaultSite.alias === siteRef)
Expand Down