@civicactions/cmsds-open-data-components 3.1.3-alpha.5 → 3.1.3-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1259,6 +1259,7 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
1259
1259
 
1260
1260
 
1261
1261
 
1262
+
1262
1263
  const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
1263
1264
  const [dataset, setDataset] = (0, $hgUW1$useState)({
1264
1265
  title: "",
@@ -1271,18 +1272,25 @@ const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additi
1271
1272
  const [id, setId] = (0, $hgUW1$useState)(datasetId);
1272
1273
  const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
1273
1274
  const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
1274
- const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
1275
+ const { data: data, isPending: isPending } = (0, $hgUW1$useQuery)({
1275
1276
  queryKey: [
1276
1277
  "metastore" + id + additionalParamsString
1277
1278
  ],
1278
1279
  queryFn: ()=>{
1279
- return fetch(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>res.json()).then((res)=>{
1280
- return res;
1280
+ return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>res.data).catch((error)=>{
1281
+ return {
1282
+ title: dataset.title,
1283
+ distribution: dataset.distribution,
1284
+ error: error,
1285
+ description: dataset.description,
1286
+ identifier: dataset.identifier,
1287
+ modified: dataset.modified
1288
+ };
1281
1289
  });
1282
1290
  }
1283
1291
  });
1284
1292
  (0, $hgUW1$useEffect)(()=>{
1285
- if (data && data != dataset) setDataset(data);
1293
+ if (!isPending && data && data != dataset) setDataset(data);
1286
1294
  }, [
1287
1295
  data
1288
1296
  ]);