19.05.2026 okkk
This commit is contained in:
@@ -62,6 +62,10 @@ export function getPaymentQuote(usdtAmount: number): Promise<PaymentQuote> {
|
||||
return doPaymentRequest(`/payment/quote?usdt_amount=${usdtAmount}`, {}, true)
|
||||
}
|
||||
|
||||
export function getPaymentQuoteByRub(rubAmount: number): Promise<PaymentQuote> {
|
||||
return doPaymentRequest(`/payment/quote/rub?total_rub=${rubAmount}`, {}, true)
|
||||
}
|
||||
|
||||
export interface CreateOrderPayload {
|
||||
usdt_amount: number
|
||||
usdt_exchange_rate: number
|
||||
|
||||
13
src/features/payment/hooks/usePaymentQuoteByRub.ts
Normal file
13
src/features/payment/hooks/usePaymentQuoteByRub.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { getPaymentQuoteByRub } from '../api/paymentApi'
|
||||
import type { PaymentQuote } from '../api/paymentApi'
|
||||
|
||||
export function usePaymentQuoteByRub(rubAmount: number) {
|
||||
return useQuery<PaymentQuote>({
|
||||
queryKey: ['payment', 'quote', 'rub', rubAmount],
|
||||
queryFn: () => getPaymentQuoteByRub(rubAmount),
|
||||
enabled: rubAmount > 0,
|
||||
staleTime: 30_000,
|
||||
retry: false,
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export { usePaymentConfig } from './hooks/usePaymentConfig'
|
||||
export { usePaymentQuote } from './hooks/usePaymentQuote'
|
||||
export { usePaymentQuoteByRub } from './hooks/usePaymentQuoteByRub'
|
||||
export { useCreateOrder } from './hooks/useCreateOrder'
|
||||
export type { PaymentConfig, PaymentQuote, CreateOrderPayload, OrderResult } from './api/paymentApi'
|
||||
|
||||
Reference in New Issue
Block a user