From 260d01899bca8ab2dfcba7067d546dac4986279b Mon Sep 17 00:00:00 2001 From: Ashritha Date: Fri, 12 Aug 2022 23:10:48 +0530 Subject: [PATCH] Added Loading state in Customise store page --- src/components/CustomizeStore.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/CustomizeStore.js b/src/components/CustomizeStore.js index ebade6ee..9f6d816a 100644 --- a/src/components/CustomizeStore.js +++ b/src/components/CustomizeStore.js @@ -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 ( +
+ {error ? ( +

+ {__( + "There was an error while loading this information", + "wp-module-ecommerce" + )} +

+ ) : ( +
+ )} +
+ ); + } return (