Fix creator balance showing as zero
This commit is contained in:
parent
0221034b60
commit
3d619e6a98
@ -88,20 +88,6 @@
|
|||||||
></span
|
></span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-display__item">
|
|
||||||
<div class="label">Current balance</div>
|
|
||||||
<div class="value">
|
|
||||||
{{ $formatMoney(auth.user.payout_data.balance, true) }}
|
|
||||||
</div>
|
|
||||||
<NuxtLink
|
|
||||||
v-if="auth.user.payout_data.balance > 0"
|
|
||||||
class="goto-link"
|
|
||||||
to="/dashboard/revenue"
|
|
||||||
>
|
|
||||||
Withdraw earnings
|
|
||||||
<ChevronRightIcon class="featured-header-chevron" aria-hidden="true" />
|
|
||||||
</NuxtLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2,21 +2,24 @@
|
|||||||
<div>
|
<div>
|
||||||
<section class="universal-card">
|
<section class="universal-card">
|
||||||
<h2 class="text-2xl">Revenue</h2>
|
<h2 class="text-2xl">Revenue</h2>
|
||||||
<div v-if="auth.user.payout_data.balance >= minWithdraw">
|
<div v-if="userBalance.available >= minWithdraw">
|
||||||
<p>
|
<p>
|
||||||
You have
|
You have
|
||||||
<strong>{{ $formatMoney(auth.user.payout_data.balance) }}</strong>
|
<strong>{{ $formatMoney(userBalance.available) }}</strong>
|
||||||
available to withdraw.
|
available to withdraw. <strong>{{ $formatMoney(userBalance.pending) }}</strong> of your
|
||||||
|
balance is <a class="text-link" href="#">pending</a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p v-else>
|
<p v-else>
|
||||||
You have made
|
You have made
|
||||||
<strong>{{ $formatMoney(auth.user.payout_data.balance) }}</strong
|
<strong>{{ $formatMoney(userBalance.available) }}</strong
|
||||||
>, which is under the minimum of ${{ minWithdraw }} to withdraw.
|
>, which is under the minimum of ${{ minWithdraw }} to withdraw.
|
||||||
|
<strong>{{ $formatMoney(userBalance.pending) }}</strong> of your balance is
|
||||||
|
<a class="text-link" href="#">pending</a>.
|
||||||
</p>
|
</p>
|
||||||
<div class="input-group mt-4">
|
<div class="input-group mt-4">
|
||||||
<nuxt-link
|
<nuxt-link
|
||||||
v-if="auth.user.payout_data.balance >= minWithdraw"
|
v-if="userBalance.available >= minWithdraw"
|
||||||
class="iconified-button brand-button"
|
class="iconified-button brand-button"
|
||||||
to="/dashboard/revenue/withdraw"
|
to="/dashboard/revenue/withdraw"
|
||||||
>
|
>
|
||||||
@ -81,6 +84,10 @@ import { TransferIcon, HistoryIcon, PayPalIcon, SaveIcon, XIcon } from "@modrint
|
|||||||
const auth = await useAuth();
|
const auth = await useAuth();
|
||||||
const minWithdraw = ref(0.01);
|
const minWithdraw = ref(0.01);
|
||||||
|
|
||||||
|
const { data: userBalance } = await useAsyncData(`payout/balance`, () =>
|
||||||
|
useBaseFetch(`payout/balance`, { apiVersion: 3 }),
|
||||||
|
);
|
||||||
|
|
||||||
async function updateVenmo() {
|
async function updateVenmo() {
|
||||||
startLoading();
|
startLoading();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
<p>
|
<p>
|
||||||
You are initiating a transfer of your revenue from Modrinth's Creator Monetization Program.
|
You are initiating a transfer of your revenue from Modrinth's Creator Monetization Program.
|
||||||
How much of your
|
How much of your
|
||||||
<strong>{{ $formatMoney(auth.user.payout_data.balance) }}</strong> balance would you like to
|
<strong>{{ $formatMoney(userBalance.available) }}</strong> balance would you like to transfer
|
||||||
transfer to {{ selectedMethod.name }}?
|
transfer to {{ selectedMethod.name }}?
|
||||||
</p>
|
</p>
|
||||||
<div class="confirmation-input">
|
<div class="confirmation-input">
|
||||||
@ -212,10 +212,13 @@ const country = ref(
|
|||||||
countries.value.find((x) => x.id === (auth.value.user.payout_data.paypal_region ?? "US")),
|
countries.value.find((x) => x.id === (auth.value.user.payout_data.paypal_region ?? "US")),
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data: payoutMethods, refresh: refreshPayoutMethods } = await useAsyncData(
|
const [{ data: userBalance }, { data: payoutMethods, refresh: refreshPayoutMethods }] =
|
||||||
`payout/methods?country=${country.value.id}`,
|
await Promise.all([
|
||||||
() => useBaseFetch(`payout/methods?country=${country.value.id}`, { apiVersion: 3 }),
|
useAsyncData(`payout/balance`, () => useBaseFetch(`payout/balance`, { apiVersion: 3 })),
|
||||||
);
|
useAsyncData(`payout/methods?country=${country.value.id}`, () =>
|
||||||
|
useBaseFetch(`payout/methods?country=${country.value.id}`, { apiVersion: 3 }),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
const selectedMethodId = ref(payoutMethods.value[0].id);
|
const selectedMethodId = ref(payoutMethods.value[0].id);
|
||||||
const selectedMethod = computed(() =>
|
const selectedMethod = computed(() =>
|
||||||
@ -295,10 +298,10 @@ const knownErrors = computed(() => {
|
|||||||
if (!parsedAmount.value && amount.value.length > 0) {
|
if (!parsedAmount.value && amount.value.length > 0) {
|
||||||
errors.push(`${amount.value} is not a valid amount`);
|
errors.push(`${amount.value} is not a valid amount`);
|
||||||
} else if (
|
} else if (
|
||||||
parsedAmount.value > auth.value.user.payout_data.balance ||
|
parsedAmount.value > userBalance.value.available ||
|
||||||
parsedAmount.value > maxWithdrawAmount.value
|
parsedAmount.value > maxWithdrawAmount.value
|
||||||
) {
|
) {
|
||||||
const maxAmount = Math.min(auth.value.user.payout_data.balance, maxWithdrawAmount.value);
|
const maxAmount = Math.min(userBalance.value.available, maxWithdrawAmount.value);
|
||||||
errors.push(`The amount must be no more than ${data.$formatMoney(maxAmount)}`);
|
errors.push(`The amount must be no more than ${data.$formatMoney(maxAmount)}`);
|
||||||
} else if (parsedAmount.value <= fees.value || parsedAmount.value < minWithdrawAmount.value) {
|
} else if (parsedAmount.value <= fees.value || parsedAmount.value < minWithdrawAmount.value) {
|
||||||
const minAmount = Math.max(fees.value + 0.01, minWithdrawAmount.value);
|
const minAmount = Math.max(fees.value + 0.01, minWithdrawAmount.value);
|
||||||
|
|||||||
@ -64,9 +64,9 @@
|
|||||||
(event) => {
|
(event) => {
|
||||||
if (event.data.modrinthOpenUrl && window.__TAURI_INTERNALS__ && lastUrl !== event.data.modrinthOpenUrl) {
|
if (event.data.modrinthOpenUrl && window.__TAURI_INTERNALS__ && lastUrl !== event.data.modrinthOpenUrl) {
|
||||||
lastUrl = event.data.modrinthOpenUrl
|
lastUrl = event.data.modrinthOpenUrl
|
||||||
window.__TAURI_INTERNALS__.invoke("plugin:shell|open", {
|
// window.__TAURI_INTERNALS__.invoke("plugin:shell|open", {
|
||||||
path: event.data.modrinthOpenUrl,
|
// path: event.data.modrinthOpenUrl,
|
||||||
});
|
// });
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
lastUrl = null
|
lastUrl = null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user