export async function save()

in src/settings.ts [217:232]


export async function save(label?: string) {
    const saved = saveSettings(settings);
    let path = "/link";
    if (label) {
        path += `/${sanitizeLabel(label)}`;
    }
    const response = await fetch(path, { method: "POST", body: JSON.stringify(saved) });
    if (response.ok) {
        const { id } = await response.json() as { id: string };
        window.location.hash = id;
        copyText(window.location.toString());
    }
    else {
        alert(`Failed to create link: ${response.status} ${response.statusText}: ${await response.text()}`);
    }
}