fix: sub renew
This commit is contained in:
@ -21,7 +21,7 @@ export function RenewSub({ sub: s }: { sub?: Subscription }) {
|
|||||||
|
|
||||||
const recentSub = mostRecentSubscription(subscriptions);
|
const recentSub = mostRecentSubscription(subscriptions);
|
||||||
const sub =
|
const sub =
|
||||||
s ?? recentSub
|
s ?? (recentSub
|
||||||
? ({
|
? ({
|
||||||
id: unwrap(recentSub).id,
|
id: unwrap(recentSub).id,
|
||||||
type: unwrap(recentSub).type,
|
type: unwrap(recentSub).type,
|
||||||
@ -29,7 +29,7 @@ export function RenewSub({ sub: s }: { sub?: Subscription }) {
|
|||||||
expires: unwrap(recentSub).end,
|
expires: unwrap(recentSub).end,
|
||||||
state: unwrap(recentSub).end > unixNow() ? "expired" : "paid",
|
state: unwrap(recentSub).end > unixNow() ? "expired" : "paid",
|
||||||
} as Subscription)
|
} as Subscription)
|
||||||
: undefined;
|
: undefined);
|
||||||
|
|
||||||
async function renew(id: string, months: number) {
|
async function renew(id: string, months: number) {
|
||||||
const api = new SnortApi(undefined, publisher);
|
const api = new SnortApi(undefined, publisher);
|
||||||
|
Reference in New Issue
Block a user