This commit is contained in:
MuslemRahimi 2025-02-02 21:26:47 +01:00
parent 75276db5bc
commit f2d57877e6

View File

@ -25,25 +25,29 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Subscription Cancelled successfully!", { toast.success("Subscription Cancelled successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
toast.success("Subscription Cancelled successfully!", { toast.success("Subscription Cancelled successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Something went wrong.", { toast.error("Something went wrong.", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -67,25 +71,29 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Subscription Reactivate successfully!", { toast.success("Subscription Reactivate successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
toast.success("Subscription Reactivate successfully!", { toast.success("Subscription Reactivate successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Something went wrong.", { toast.error("Something went wrong.", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -109,25 +117,29 @@
switch (result.type) { switch (result.type) {
case "success": case "success":
toast.success("Changing to Annual Plan successfully!", { toast.success("Changing to Annual Plan successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "redirect": case "redirect":
toast.success("Changing to Annual Plan successfully!", { toast.success("Changing to Annual Plan successfully!", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "failure": case "failure":
toast.error("Something went wrong.", { toast.error("Something went wrong.", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
await update(); await update();
break; break;
case "error": case "error":
toast.error(result.error.message, { toast.error(result.error.message, {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
break; break;
default: default:
@ -151,7 +163,6 @@
nottifPermGranted = await requestNotificationPermission(); nottifPermGranted = await requestNotificationPermission();
if (nottifPermGranted) { if (nottifPermGranted) {
isPushSubscribed = (await checkSubscriptionStatus()) || false; isPushSubscribed = (await checkSubscriptionStatus()) || false;
console.log(isPushSubscribed);
} }
} }
}); });
@ -161,7 +172,7 @@
isPushSubscribed = false; isPushSubscribed = false;
toast.success("Push notification deactivated successfully!", { toast.success("Push notification deactivated successfully!", {
style: style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;", // gray-600 hex color "border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
@ -170,7 +181,7 @@
isPushSubscribed = true; isPushSubscribed = true;
toast.success("Push notification activated successfully!", { toast.success("Push notification activated successfully!", {
style: style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;", // gray-600 hex color "border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
</script> </script>
@ -257,25 +268,11 @@
on:click={handlePushSubscribe}>Enable notifications</button on:click={handlePushSubscribe}>Enable notifications</button
> >
{/if} {/if}
<!--
{:else if nottifPermGranted === false} {:else if nottifPermGranted === false}
<button <p class="">
class="button" Review your settings and enable notifications to stay updated
type="button" with Stocknear alerts.
on:click={requestNotificationPermission} </p>
>Enable notifications</button
>
{:else}
<p>Push notification is currently active.</p>
<div class="mt-3">
<button
class="border border-gray-600 w-fit px-5 py-1.5 bg-white text-black font-semibold rounded sm:hover:bg-white/80 transition ease-out duration-100"
type="button"
on:click={unsubscribe}>Disable notifications</button
>
</div>
-->
{/if} {/if}
</div> </div>
</div> </div>