Handle auction not found error
Some checks failed
Lint / lint (20.x) (pull_request) Failing after 0s
Some checks failed
Lint / lint (20.x) (pull_request) Failing after 0s
This commit is contained in:
parent
82a33221a9
commit
85cb304f55
@ -43,6 +43,11 @@ export const AuctionCard = ({ project }: { project: Project }) => {
|
|||||||
|
|
||||||
const checkAuctionStatus = useCallback(async () => {
|
const checkAuctionStatus = useCallback(async () => {
|
||||||
const result = await client.getAuctionData(project.auctionId);
|
const result = await client.getAuctionData(project.auctionId);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
setAuctionStatus(result.status);
|
setAuctionStatus(result.status);
|
||||||
setAuctionDetails(result);
|
setAuctionDetails(result);
|
||||||
}, [project.auctionId, project.deployers, project.fundsReleased]);
|
}, [project.auctionId, project.deployers, project.fundsReleased]);
|
||||||
|
@ -204,7 +204,7 @@ const OverviewTabPanel = () => {
|
|||||||
{project.deployments &&
|
{project.deployments &&
|
||||||
project.deployments.length > 0 &&
|
project.deployments.length > 0 &&
|
||||||
project.deployments.map((deployment) => (
|
project.deployments.map((deployment) => (
|
||||||
<div className="flex gap-2 items-center">
|
<div key={deployment.id} className="flex gap-2 items-center">
|
||||||
<Link to={deployment.applicationDeploymentRecordData.url}>
|
<Link to={deployment.applicationDeploymentRecordData.url}>
|
||||||
<span className="text-controls-primary dark:text-foreground group hover:border-controls-primary transition-colors border-b border-b-transparent flex gap-2 items-center text-sm tracking-tight">
|
<span className="text-controls-primary dark:text-foreground group hover:border-controls-primary transition-colors border-b border-b-transparent flex gap-2 items-center text-sm tracking-tight">
|
||||||
{deployment.applicationDeploymentRecordData.url}
|
{deployment.applicationDeploymentRecordData.url}
|
||||||
|
@ -414,14 +414,25 @@ export class GQLClient {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAuctionData(auctionId: string): Promise<types.Auction> {
|
async getAuctionData(auctionId: string): Promise<types.Auction | null> {
|
||||||
const { data } = await this.client.query({
|
const { data, errors } = await this.client.query({
|
||||||
query: queries.getAuctionData,
|
query: queries.getAuctionData,
|
||||||
variables: {
|
variables: {
|
||||||
auctionId,
|
auctionId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (errors && errors.length) {
|
||||||
|
const isAuctionNotFound = errors.some((error) =>
|
||||||
|
error.message?.includes('Auction not found')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isAuctionNotFound) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data.getAuctionData;
|
return data.getAuctionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user