mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
fix(server): avoid error when other prices added but logic is not released (#6191)
This commit is contained in:
@@ -108,8 +108,8 @@ const SubscriptionSettings = () => {
|
||||
? '0'
|
||||
: price
|
||||
? recurring === SubscriptionRecurring.Monthly
|
||||
? String(price.amount / 100)
|
||||
: String(price.yearlyAmount / 100)
|
||||
? String((price.amount ?? 0) / 100)
|
||||
: String((price.yearlyAmount ?? 0) / 100)
|
||||
: '?';
|
||||
|
||||
const t = useAFFiNEI18N();
|
||||
|
||||
@@ -51,11 +51,14 @@ const Settings = () => {
|
||||
const detail = planDetail.get(price.plan);
|
||||
|
||||
if (detail?.type === 'fixed') {
|
||||
detail.price = (price.amount / 100).toFixed(2);
|
||||
detail.yearlyPrice = (price.yearlyAmount / 100 / 12).toFixed(2);
|
||||
detail.discount = Math.floor(
|
||||
(1 - price.yearlyAmount / 12 / price.amount) * 100
|
||||
).toString();
|
||||
detail.price = ((price.amount ?? 0) / 100).toFixed(2);
|
||||
detail.yearlyPrice = ((price.yearlyAmount ?? 0) / 100 / 12).toFixed(2);
|
||||
detail.discount =
|
||||
price.yearlyAmount && price.amount
|
||||
? Math.floor(
|
||||
(1 - price.yearlyAmount / 12 / price.amount) * 100
|
||||
).toString()
|
||||
: undefined;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user