Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
undo.ts850 B
import { showUndoToast } from "@/components/ui/undo-toast"; type UndoableAction<T = void> = { action: () => Promise<T>; onUndo?: () => void; message: string; duration?: number; toastId?: string; }; export async function withUndo<T = void>({ action, onUndo, message, duration = 5000, toastId, }: UndoableAction<T>): Promise<T | undefined> { return new Promise((resolve, reject) => { let isUndone = false; showUndoToast({ message, duration, toastId, onUndo: () => { isUndone = true; onUndo?.(); resolve(undefined); }, onComplete: async () => { if (!isUndone) { try { const result = await action(); resolve(result); } catch (error) { reject(error); } } }, }); }); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server