Skip to content

Commit

Permalink
handle pending response
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-luger committed Jul 8, 2024
1 parent 10f34a4 commit 80ce33e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions components/ArchivedAuctions.tsx/ArchivedAuctions.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,5 +677,5 @@ interface ArchivedAuction {

interface ArchivedAuctionResponse {
auctions: ArchivedAuction[]
queryStatus: string
queryStatus: 'Success' | 'NoResults' | 'Pending' | 'Partial'
}

0 comments on commit 80ce33e

Please sign in to comment.