diff --git a/src/routes/(app)/workspace/tools/edit/+page.svelte b/src/routes/(app)/workspace/tools/edit/+page.svelte index 036c210d73..3584ece2d5 100644 --- a/src/routes/(app)/workspace/tools/edit/+page.svelte +++ b/src/routes/(app)/workspace/tools/edit/+page.svelte @@ -56,19 +56,22 @@ const id = $page.url.searchParams.get('id'); if (id) { - tool = await getToolById(localStorage.token, id).catch((error) => { + const res = await getToolById(localStorage.token, id).catch((error) => { toast.error(`${error}`); goto('/workspace/tools'); return null; }); - if (tool && !tool.write_access) { + if (res && !res.write_access) { toast.error($i18n.t('You do not have permission to edit this tool')); goto('/workspace/tools'); return; } - console.log(tool); + if (res) { + tool = res; + console.log(tool); + } } });