Skip to content

Commit

Permalink
feat: If id no data show nodata component
Browse files Browse the repository at this point in the history
  • Loading branch information
ybgbob committed Nov 24, 2023
1 parent 3ca76b9 commit 0d287b2
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/pages/Resource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { useGetItemById } from '../hooks/useGetItemById';
import { useGetItemRelationWithAddr } from '../hooks/useGetItemRelationWithAddr';
import { reportEvent } from '../utils/ga';
import { NoData } from '../components/NoData';

/**
* Have been listed
Expand All @@ -29,26 +30,13 @@ import { reportEvent } from '../utils/ga';
*/
const Resource = () => {
const [p] = useSearchParams();
// const groupId = p.getAll('gid')[0];
// const cid = p.getAll('cid')[0];
// const objectId = p.get('oid') as string;
// const gName = p.getAll('gn')[0];
// const bGroupName = p.getAll('bgn')[0];
const itemId = p.get('id') as string;
// const bucketId = p.getAll('bid')[0]

const { address } = useAccount();

const { data: itemInfo, isLoading: itemInfoLoading } = useGetItemById(
parseInt(itemId),
);

// console.log('p.getAll(oid)', p.get('oid'), p.get('id'));
// console.log('objectId: ', objectId);

// const { data: xx } = useGfGetObjInfo(objectId);
// console.log('xx', xx);

const relation = useGetItemRelationWithAddr(address, itemInfo);

const storageInfo = useGetBOInfoFromGroup(itemInfo?.groupName);
Expand All @@ -73,16 +61,14 @@ const Resource = () => {
: `${bucketData.bucketInfo.bucketName} #${itemInfo?.name}`;
}, [bucketData, itemInfo, storageInfo]);

// console.log('itemInfo', itemInfo);
// console.log('storageInfo', storageInfo);
// console.log('groupData', groupData);
// console.log('bucketData', bucketData);
// console.log('objectData', objectData);

if (itemInfoLoading || !itemInfo || !bucketData) {
if (itemInfoLoading) {
return <Loader />;
}

if (!itemInfo || !bucketData) {
return <NoData />;
}

return (
<Container>
<MyBreadcrumb
Expand Down

0 comments on commit 0d287b2

Please sign in to comment.