From 80ce33e82cff8f51bdc4bbc6d9135499f7351402 Mon Sep 17 00:00:00 2001 From: Matthias Luger Date: Mon, 8 Jul 2024 18:29:29 +0200 Subject: [PATCH] handle pending response --- .../ArchivedAuctions.tsx/ArchivedAuctions.tsx | 13 ++++++++++--- global.d.ts | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/ArchivedAuctions.tsx/ArchivedAuctions.tsx b/components/ArchivedAuctions.tsx/ArchivedAuctions.tsx index b02c6a46..7e148bcc 100644 --- a/components/ArchivedAuctions.tsx/ArchivedAuctions.tsx +++ b/components/ArchivedAuctions.tsx/ArchivedAuctions.tsx @@ -1,6 +1,6 @@ 'use client' -import React, { useEffect, useRef, useState } from 'react' -import { Button, Card, ListGroup } from 'react-bootstrap' +import React, { useRef, useState } from 'react' +import { Button, Card } from 'react-bootstrap' import styles from './ArchivedAuctions.module.css' import Link from 'next/link' import Image from 'next/image' @@ -9,7 +9,7 @@ import moment from 'moment' import api from '../../api/ApiHelper' import { getLoadingElement } from '../../utils/LoadingUtils' import GoogleSignIn from '../GoogleSignIn/GoogleSignIn' -import { PREMIUM_RANK, getHighestPriorityPremiumProduct, hasHighEnoughPremium } from '../../utils/PremiumTypeUtils' +import { PREMIUM_RANK, hasHighEnoughPremium } from '../../utils/PremiumTypeUtils' import DatePicker from 'react-datepicker' import ItemFilter from '../ItemFilter/ItemFilter' import Tooltip from '../Tooltip/Tooltip' @@ -87,6 +87,13 @@ const ArchivedAuctionsList = (props: Props) => { page: reset ? 0 : currentPageRef.current.toString() }) + if (data.queryStatus === 'Pending') { + setTimeout(() => { + search() + }, 1000) + return + } + let newAuctions = [...archivedAuctionsRef.current, ...data.auctions] archivedAuctionsRef.current = newAuctions setArchivedAuctions(newAuctions) diff --git a/global.d.ts b/global.d.ts index f5d3e723..d7a1fe97 100644 --- a/global.d.ts +++ b/global.d.ts @@ -677,5 +677,5 @@ interface ArchivedAuction { interface ArchivedAuctionResponse { auctions: ArchivedAuction[] - queryStatus: string + queryStatus: 'Success' | 'NoResults' | 'Pending' | 'Partial' }