Svelte UI for managing email subscription permissions, calling add/delete endpoints, showing loading state and toast notifications.
<!--
Source: https://github.com/leomorpho/goship | License: MIT | Copyright 2022 Mike Stefanello
Provided via justclaw.it.com; keep this notice with the code.
-->
<script>
import { toast } from "wc-toast";
import PermissionButton from "./PermissionButton.svelte";
import EmailPermissionDisabledIcon from "./icons/EmailDisabledIcon.svelte";
import EmailPermissionEnabledIcon from "./icons/EmailEnabledIcon.svelte";
import LoadingSpinner from "./icons/LoadingSpinner.svelte";
export let permissionGranted = false;
export let addEmailSubscriptionEndpoint = "";
export let deleteEmailSubscriptionEndpoint = "";
export let permissionKey = "";
export let notificationTypeQueryParamKey = "";
let loading = false;
async function subscribeUser() {
loading = true;
try {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key