refac: clone

This commit is contained in:
Timothy J. Baek
2024-06-10 22:16:49 -07:00
parent 8464b30485
commit 3578b5e337
2 changed files with 6 additions and 2 deletions
@@ -6,6 +6,7 @@
import { onMount } from 'svelte';
import { toast } from 'svelte-sonner';
let clone = false;
let tool = null;
const saveHandler = async (data) => {
@@ -34,6 +35,7 @@
if (sessionStorage.tool) {
tool = JSON.parse(sessionStorage.tool);
sessionStorage.removeItem('tool');
clone = true;
}
});
</script>
@@ -43,6 +45,7 @@
name={tool?.name ?? ''}
meta={tool?.meta ?? { description: '' }}
content={tool?.content ?? ''}
{clone}
on:save={(e) => {
saveHandler(e.detail);
}}