mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: simplify subscription cancellation
This commit is contained in:
committed by
Abdullah Atta
parent
be957d058f
commit
fb54125ee6
@@ -1288,40 +1288,49 @@ function AccountStatus(props) {
|
||||
</>
|
||||
) : isPro ? (
|
||||
<>
|
||||
<Button
|
||||
variant="list"
|
||||
onClick={async () => {
|
||||
if (!user.subscription.updateURL)
|
||||
return showToast(
|
||||
"error",
|
||||
"Failed to update. Please reach out to us at support@streetwriters.co so we can help you resolve the issue."
|
||||
);
|
||||
window.open(user.subscription.updateURL, "_blank");
|
||||
}}
|
||||
>
|
||||
<Tip
|
||||
text="Update payment method"
|
||||
tip="Update the payment method you used to purchase this subscription."
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
variant="list"
|
||||
sx={{ ":hover": { borderColor: "error" } }}
|
||||
onClick={async () => {
|
||||
if (!user.subscription.cancelURL)
|
||||
return showToast(
|
||||
"error",
|
||||
"Failed to cancel subscription. Please reach out to us at support@streetwriters.co so we can help you resolve the issue."
|
||||
);
|
||||
window.open(user.subscription.cancelURL, "_blank");
|
||||
}}
|
||||
>
|
||||
<Tip
|
||||
color="error"
|
||||
text="Cancel subscription"
|
||||
tip="You will be downgraded to the Basic plan at the end of your billing period."
|
||||
/>
|
||||
</Button>
|
||||
{provider === "Web" ? (
|
||||
<>
|
||||
<Button
|
||||
variant="list"
|
||||
onClick={async () => {
|
||||
try {
|
||||
window.open(await db.subscriptions.updateUrl(), "_blank");
|
||||
} catch (e) {
|
||||
showToast("error", e.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Tip
|
||||
text="Update payment method"
|
||||
tip="Update the payment method you used to purchase this subscription."
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
variant="list"
|
||||
sx={{ ":hover": { borderColor: "error" } }}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await db.subscriptions.cancel();
|
||||
showToast(
|
||||
"success",
|
||||
"Your subscription has been cancelled."
|
||||
);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 5000);
|
||||
} catch (e) {
|
||||
showToast("error", e.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Tip
|
||||
color="error"
|
||||
text="Cancel subscription"
|
||||
tip="You will be downgraded to the Basic plan at the end of your billing period."
|
||||
/>
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
<Text
|
||||
variant="subBody"
|
||||
mt={1}
|
||||
|
||||
Reference in New Issue
Block a user