Fix subscription settings loading bug

This commit is contained in:
silverpill 2022-09-19 18:36:58 +00:00
parent 10423fa5b3
commit 75e381e694

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="subscription-settings"> <div class="subscription-settings">
<div class="info" v-if="!isLoading"> <div class="info" v-if="subscriptionOptionLoaded">
<template v-if="subscriptionOption !== null"> <template v-if="subscriptionOption !== null">
<span>Subscriptions are enabled</span> <span>Subscriptions are enabled</span>
<div class="price"> <div class="price">
@ -78,6 +78,7 @@ const {
let isLoading = $ref(false) let isLoading = $ref(false)
let subscriptionOption = $ref<SubscriptionOption | null>(null) let subscriptionOption = $ref<SubscriptionOption | null>(null)
let subscriptionOptionLoaded = $ref(false)
let subscriptionPrice = $ref(0.01) let subscriptionPrice = $ref(0.01)
let subscriptionPayoutAddress = $ref("") let subscriptionPayoutAddress = $ref("")
@ -94,6 +95,7 @@ async function loadSubscriptionSettings() {
subscriptionOption = subscriptionOptions.find((item) => { subscriptionOption = subscriptionOptions.find((item) => {
return item.type === "monero" return item.type === "monero"
}) || null }) || null
subscriptionOptionLoaded = true
if (subscriptionOption?.price && subscriptionOption?.payout_address) { if (subscriptionOption?.price && subscriptionOption?.payout_address) {
subscriptionPrice = getPricePerMonth(subscriptionOption.price) subscriptionPrice = getPricePerMonth(subscriptionOption.price)
subscriptionPayoutAddress = subscriptionOption.payout_address subscriptionPayoutAddress = subscriptionOption.payout_address