Skip to content

Commit

Permalink
Refactor Edit.astro to fix display issue with edit page content
Browse files Browse the repository at this point in the history
  • Loading branch information
Adammatthiesen committed Dec 25, 2024
1 parent 661bd12 commit 309e624
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import { StudioCMSRoutes } from 'studiocms:lib';
const editPageContent = document.getElementById('edit-page-content');

// get the page data
const pageDataResponse = await (await fetch(currentDisplayData.dataset.link)).json();
const pageDataResponse = await (await fetch(editPageContainer.dataset.link)).json();

if (id) {
// find the page data from the list
const pageData = pageDataResponse.pages.find((page) => page.data.id === id);

editPageContainer.style.display = 'block';
editPageContent.style.display = 'block';

if (pageData) {
editPageContent.innerHTML = `
Expand All @@ -44,6 +45,7 @@ import { StudioCMSRoutes } from 'studiocms:lib';
`;

editPageContainer.style.display = 'none';
editPageContent.style.display = 'none';
}
}

Expand Down

0 comments on commit 309e624

Please sign in to comment.