Skip to content

Commit

Permalink
Added Loading state in Customise store page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashritha committed Aug 12, 2022
1 parent 52bcb1d commit 260d018
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/CustomizeStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,28 @@ const CustomizeList = [
];

export function CustomizeStore({ plugins }) {
let { data: status } = useSWR(Endpoints.PAGE_STATUS);
let { data: status, error } = useSWR(Endpoints.PAGE_STATUS);
let { pages, theme } = status ?? {};
let pagesByName = Object.fromEntries(
pages?.map((_) => [_["meta_value"], _["ID"]]) ?? []
);
// TODO: Add Loading state

if (status === undefined) {
return (
<div style={{ height: "100%", display: "grid", placeContent: "center" }}>
{error ? (
<h2>
{__(
"There was an error while loading this information",
"wp-module-ecommerce"
)}
</h2>
) : (
<div className="bwa-loader" />
)}
</div>
);
}
return (
<DashboardContent
title={__("Customize Your Store", "wp-module-ecommerce")}
Expand Down

0 comments on commit 260d018

Please sign in to comment.