Skip to main content
Glama
toast.ts1.29 kB
/** * Toast notification utilities */ import type { AppAction, ToastNotification } from '../types'; let toastIdCounter = 0; export const createToast = ( type: ToastNotification['type'], title: string, message: string, duration?: number ): ToastNotification => ({ id: `toast-${++toastIdCounter}`, type, title, message, duration }); export const showSuccessToast = (dispatch: React.Dispatch<AppAction>) => (title: string, message: string, duration?: number) => { dispatch({ type: 'ADD_TOAST', payload: createToast('success', title, message, duration) }); }; export const showInfoToast = (dispatch: React.Dispatch<AppAction>) => (title: string, message: string, duration?: number) => { dispatch({ type: 'ADD_TOAST', payload: createToast('info', title, message, duration) }); }; export const showWarningToast = (dispatch: React.Dispatch<AppAction>) => (title: string, message: string, duration?: number) => { dispatch({ type: 'ADD_TOAST', payload: createToast('warning', title, message, duration) }); }; export const showErrorToast = (dispatch: React.Dispatch<AppAction>) => (title: string, message: string, duration?: number) => { dispatch({ type: 'ADD_TOAST', payload: createToast('error', title, message, duration) }); };

Latest Blog Posts

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/eyaltoledano/claude-task-master'

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