fix(lint): resolve floating promise warnings
This commit is contained in:
@@ -87,20 +87,28 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
setLoading(true)
|
||||
setOrder(null)
|
||||
setExistingDispute(null)
|
||||
|
||||
Promise.all([Promise.resolve(getOrderById(id)), Promise.resolve(getDisputeByOrderId(id))])
|
||||
.then(([nextOrder, nextDispute]) => {
|
||||
if (cancelled) return
|
||||
setOrder(nextOrder ?? null)
|
||||
setExistingDispute(nextDispute ?? null)
|
||||
})
|
||||
.finally(() => {
|
||||
if (cancelled) return
|
||||
setLoading(false)
|
||||
})
|
||||
const reset = () => {
|
||||
setLoading(true)
|
||||
setOrder(null)
|
||||
setExistingDispute(null)
|
||||
}
|
||||
|
||||
const load = async () => {
|
||||
reset()
|
||||
|
||||
const [nextOrder, nextDispute] = await Promise.all([
|
||||
Promise.resolve(getOrderById(id)),
|
||||
Promise.resolve(getDisputeByOrderId(id)),
|
||||
])
|
||||
|
||||
if (cancelled) return
|
||||
setOrder(nextOrder ?? null)
|
||||
setExistingDispute(nextDispute ?? null)
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
void load()
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
@@ -162,7 +170,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
const handleSubmit = () => {
|
||||
if (!userId || !reason.trim()) return
|
||||
|
||||
Promise.resolve(
|
||||
void Promise.resolve(
|
||||
submitDispute({
|
||||
orderId: id,
|
||||
reason,
|
||||
@@ -349,7 +357,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (!userId) return
|
||||
Promise.resolve(
|
||||
void Promise.resolve(
|
||||
submitDisputeResponse({
|
||||
disputeId: existingDispute.id,
|
||||
reason: responseReason,
|
||||
@@ -401,7 +409,7 @@ export default function DisputePage({ params }: { params: Promise<{ id: string }
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
if (!userId) return
|
||||
Promise.resolve(
|
||||
void Promise.resolve(
|
||||
submitDisputeAppeal({
|
||||
disputeId: existingDispute.id,
|
||||
reason: appealReason,
|
||||
|
||||
Reference in New Issue
Block a user