MCPcopy Create free account
hub / github.com/ShipSecAI/studio / handleSave

Function handleSave

frontend/src/pages/WebhookEditorPage.tsx:220–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218 }, [id, isNew]);
219
220 const handleSave = async () => {
221 setIsSaving(true);
222 try {
223 const payload = {
224 ...form,
225 expectedInputs: form.expectedInputs, // simplified for now
226 };
227
228 if (isNew) {
229 const created = (await api.webhooks.create(payload)) as any;
230 toast({ title: 'Webhook created' });
231 setInitialForm(payload);
232 navigate(`/webhooks/${created.id}`, { replace: true });
233 } else {
234 await api.webhooks.update(id!, payload);
235 setInitialForm(payload);
236 toast({ title: 'Webhook saved' });
237 }
238 } catch (error) {
239 toast({
240 title: 'Save failed',
241 description: String(error),
242 variant: 'destructive',
243 });
244 } finally {
245 setIsSaving(false);
246 }
247 };
248
249 // Keyboard shortcut
250 useEffect(() => {

Callers 1

handleKeyDownFunction · 0.70

Calls 2

createMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected