refac
This commit is contained in:
@@ -56,19 +56,22 @@
|
|||||||
const id = $page.url.searchParams.get('id');
|
const id = $page.url.searchParams.get('id');
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
tool = await getToolById(localStorage.token, id).catch((error) => {
|
const res = await getToolById(localStorage.token, id).catch((error) => {
|
||||||
toast.error(`${error}`);
|
toast.error(`${error}`);
|
||||||
goto('/workspace/tools');
|
goto('/workspace/tools');
|
||||||
return null;
|
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'));
|
toast.error($i18n.t('You do not have permission to edit this tool'));
|
||||||
goto('/workspace/tools');
|
goto('/workspace/tools');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(tool);
|
if (res) {
|
||||||
|
tool = res;
|
||||||
|
console.log(tool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user