mirror of https://github.com/certusone/oyster.git
use first obligation when clicking repay from reserve overview
This commit is contained in:
parent
6b03bf31a1
commit
dff1d6e1c1
|
@ -5,6 +5,7 @@ import {
|
||||||
useUserBalance,
|
useUserBalance,
|
||||||
useBorrowedAmount,
|
useBorrowedAmount,
|
||||||
useBorrowingPower,
|
useBorrowingPower,
|
||||||
|
useUserObligationByReserve,
|
||||||
} from "./../../hooks";
|
} from "./../../hooks";
|
||||||
import { LendingReserve } from "../../models/lending";
|
import { LendingReserve } from "../../models/lending";
|
||||||
import { formatNumber } from "../../utils/utils";
|
import { formatNumber } from "../../utils/utils";
|
||||||
|
@ -44,6 +45,7 @@ export const UserLendingCard = (props: {
|
||||||
totalInQuote: borrowingPowerInUSD,
|
totalInQuote: borrowingPowerInUSD,
|
||||||
borrowingPower,
|
borrowingPower,
|
||||||
} = useBorrowingPower(address);
|
} = useBorrowingPower(address);
|
||||||
|
const { userObligationsByReserve } = useUserObligationByReserve(address);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
@ -156,9 +158,13 @@ export const UserLendingCard = (props: {
|
||||||
<Link to={`/withdraw/${address}`}>
|
<Link to={`/withdraw/${address}`}>
|
||||||
<Button>{LABELS.WITHDRAW_ACTION}</Button>
|
<Button>{LABELS.WITHDRAW_ACTION}</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Link to={`/repay/${address}`}>
|
{!!userObligationsByReserve.length && (
|
||||||
<Button>{LABELS.REPAY_ACTION}</Button>
|
<Link
|
||||||
</Link>
|
to={`/repay/loan/${userObligationsByReserve[0].obligation.account.pubkey.toBase58()}`}
|
||||||
|
>
|
||||||
|
<Button>{LABELS.REPAY_ACTION}</Button>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue