add paywall to save strategy

This commit is contained in:
MuslemRahimi 2025-04-08 23:54:03 +02:00
parent 5868ef46a8
commit e486b86c22

View File

@ -1355,6 +1355,12 @@
} }
async function handleSaveStrategy() { async function handleSaveStrategy() {
if (data?.user?.tier !== "Pro") {
toast.error("Upgrade to Pro to unlock this feature!", {
style: `border-radius: 5px; background: #fff; color: #000; border: 1px solid ${$mode === "light" ? "#F3F4F6" : "#4B5563"}; font-size: 15px; padding: 10px;`,
});
return;
}
try { try {
// Create filtered strategies without strikeList and dateList // Create filtered strategies without strikeList and dateList
const strategiesToSave = userStrategy.map( const strategiesToSave = userStrategy.map(
@ -1379,6 +1385,7 @@
} }
onMount(async () => { onMount(async () => {
if (data?.user?.tier === "Pro") {
try { try {
const savedStrategy = localStorage?.getItem( const savedStrategy = localStorage?.getItem(
"options-calculator-strategy", "options-calculator-strategy",
@ -1392,6 +1399,7 @@
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
}
await getStockData(); await getStockData();
await loadData(); await loadData();