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

MWPW-161174 fixed library query param #3128

Merged
merged 1 commit into from
Nov 6, 2024
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
7 changes: 3 additions & 4 deletions libs/blocks/library-config/library-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ async function loadList(type, content, list) {
}
}

async function fetchLibrary(domain) {
const { searchParams } = new URL(window.location.href);
const suppliedLibrary = searchParams.get('library');
async function fetchLibrary(domain, suppliedLibrary) {
const library = suppliedLibrary || `${domain}${LIBRARY_PATH}`;
try {
const resp = await fetch(library);
Expand All @@ -129,8 +127,9 @@ async function getSuppliedLibrary() {
const { searchParams } = new URL(window.location.href);
const repo = searchParams.get('repo');
const owner = searchParams.get('owner');
const library = searchParams.get('library');
if (!repo || !owner) return null;
return fetchLibrary(`https://main--${repo}--${owner}.hlx.live`);
return fetchLibrary(`https://main--${repo}--${owner}.hlx.live`, library);
}

async function fetchAssetsData(path) {
Expand Down
Loading