From 958c2b690de1a04f7c50ddc63f8be448f0aba349 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 8 Aug 2023 14:36:25 -0500 Subject: [PATCH] handle expired subscriptions --- src/i18n/en/translations.ts | 2 ++ src/routes/settings/Plus.tsx | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index 2d29b7c..61ec870 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -358,6 +358,8 @@ export default { error_no_plan: "No plans found", error_failure: "Couldn't subscribe", error_no_subscription: "No existing subscription found", + error_expired_subscription: + "Your subscription has expired, click join to renew", satisfaction: "Smug satisfaction", gifting: "Gifting", multi_device: "Multi-device access", diff --git a/src/routes/settings/Plus.tsx b/src/routes/settings/Plus.tsx index 5c3f4fb..1a2deaa 100644 --- a/src/routes/settings/Plus.tsx +++ b/src/routes/settings/Plus.tsx @@ -113,6 +113,17 @@ function PlusCTA() { new Error(i18n.t("settings.plus.error_no_subscription")) ); } + + if ( + state.subscription_timestamp && + state.subscription_timestamp < Math.ceil(Date.now() / 1000) + ) { + setError( + new Error( + i18n.t("settings.plus.error_expired_subscription") + ) + ); + } } catch (e) { console.error(e); setError(eify(e));