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 result = await client.getAuctionData(project.auctionId);
|
||||
|
||||
if (!result) {
|
||||
return
|
||||
}
|
||||
|
||||
setAuctionStatus(result.status);
|
||||
setAuctionDetails(result);
|
||||
}, [project.auctionId, project.deployers, project.fundsReleased]);
|
||||
|
@ -204,7 +204,7 @@ const OverviewTabPanel = () => {
|
||||
{project.deployments &&
|
||||
project.deployments.length > 0 &&
|
||||
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}>
|
||||
<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}
|
||||
|
@ -414,14 +414,25 @@ export class GQLClient {
|
||||
return data;
|
||||
}
|
||||
|
||||
async getAuctionData(auctionId: string): Promise<types.Auction> {
|
||||
const { data } = await this.client.query({
|
||||
async getAuctionData(auctionId: string): Promise<types.Auction | null> {
|
||||
const { data, errors } = await this.client.query({
|
||||
query: queries.getAuctionData,
|
||||
variables: {
|
||||
auctionId,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
if (errors && errors.length) {
|
||||
const isAuctionNotFound = errors.some((error) =>
|
||||
error.message?.includes('Auction not found')
|
||||
);
|
||||
|
||||
if (isAuctionNotFound) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
return data.getAuctionData;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user