mirror of
https://github.com/LukeHagar/OpenAPI.gg.git
synced 2025-12-06 04:20:29 +00:00
Added save button
This commit is contained in:
18
src/lib/components/FileManagement/SaveButton.svelte
Normal file
18
src/lib/components/FileManagement/SaveButton.svelte
Normal file
@@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { openApiStore } from '$lib';
|
||||
import { db, selectedSpec } from '$lib/db';
|
||||
|
||||
function onSave(e: Event): void {
|
||||
console.log('Save button clicked');
|
||||
if (!$selectedSpec) {
|
||||
$selectedSpec = {
|
||||
name: 'New OpenAPI Spec',
|
||||
spec: $openApiStore
|
||||
};
|
||||
}
|
||||
console.log($selectedSpec);
|
||||
db.apiSpecs.put($selectedSpec, $selectedSpec.id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="btn variant-ghost-success" on:click={onSave}> Save </button>
|
||||
Reference in New Issue
Block a user