type aligning of assets and proposals
This commit is contained in:
parent
da12f0b5cd
commit
eba2a8ac70
@ -16,14 +16,15 @@ type Proposal = {
|
||||
type ProposalEdge = {
|
||||
node: Proposal;
|
||||
};
|
||||
type ProposalEdges = {
|
||||
edges: (ProposalEdge | null)[] | null;
|
||||
};
|
||||
type ProposalsConnection = {
|
||||
proposalsConnection: {
|
||||
edges: (ProposalEdge | null)[] | null;
|
||||
};
|
||||
proposalsConnection: ProposalEdges | null;
|
||||
};
|
||||
|
||||
export const getProposals = (data?: ProposalsConnection) => {
|
||||
const proposals = data?.proposalsConnection.edges
|
||||
const proposals = data?.proposalsConnection?.edges
|
||||
?.filter((e) => e?.node)
|
||||
.map((e) => e?.node);
|
||||
return proposals ? (proposals as Proposal[]) : [];
|
||||
|
@ -45,10 +45,10 @@ type AssetEdge<T extends Asset> = {
|
||||
node: T;
|
||||
};
|
||||
|
||||
type AssetEdges<T extends Asset> = { edges: (AssetEdge<T> | null)[] | null };
|
||||
|
||||
type AssetsConnection<T extends Asset> = {
|
||||
assetsConnection: {
|
||||
edges: (AssetEdge<T> | null)[] | null;
|
||||
};
|
||||
assetsConnection: AssetEdges<T> | null;
|
||||
};
|
||||
|
||||
export const getAssets = (data?: AssetsConnection<Asset>): Asset[] =>
|
||||
|
Loading…
Reference in New Issue
Block a user