Spaces:
Paused
Paused
fix(tools): prevent form double submit
Browse files
src/routes/tools/ToolEdit.svelte
CHANGED
|
@@ -161,13 +161,15 @@
|
|
| 161 |
formData.append("tool", JSON.stringify(editableTool));
|
| 162 |
|
| 163 |
return async ({ result }) => {
|
| 164 |
-
formLoading = false;
|
| 165 |
-
|
| 166 |
if (result.type === "success" && result.data && typeof result.data.toolId === "string") {
|
| 167 |
$settings.tools = [...($settings.tools ?? []), result.data.toolId];
|
| 168 |
-
goto(`${base}/tools/${result.data.toolId}
|
|
|
|
|
|
|
| 169 |
} else {
|
| 170 |
-
await applyAction(result)
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
};
|
| 173 |
}}
|
|
|
|
| 161 |
formData.append("tool", JSON.stringify(editableTool));
|
| 162 |
|
| 163 |
return async ({ result }) => {
|
|
|
|
|
|
|
| 164 |
if (result.type === "success" && result.data && typeof result.data.toolId === "string") {
|
| 165 |
$settings.tools = [...($settings.tools ?? []), result.data.toolId];
|
| 166 |
+
await goto(`${base}/tools/${result.data.toolId}`).then(() => {
|
| 167 |
+
formLoading = false;
|
| 168 |
+
});
|
| 169 |
} else {
|
| 170 |
+
await applyAction(result).then(() => {
|
| 171 |
+
formLoading = false;
|
| 172 |
+
});
|
| 173 |
}
|
| 174 |
};
|
| 175 |
}}
|