Files
OpenAPI.gg/src/lib/components/FileManagement/DeleteAllButton.svelte
2024-07-04 17:05:59 +00:00

20 lines
460 B
Svelte

<script lang="ts">
import { newSpec } from '$lib/db';
import { db, loadSpec, type APISpec } from '$lib/db';
import type { CssClasses } from '@skeletonlabs/skeleton';
export let width: CssClasses = "w-full"
</script>
<button
class="btn variant-ghost-error {width}"
on:click={async () => {
if (confirm(`Are you sure you want to delete all saved specs?`)) {
db.apiSpecs.clear();
loadSpec(structuredClone(newSpec));
}
}}
>
Delete All
</button>