Skip to content

toastStore

Visão Geral

Store Zustand para gerenciar notificações toast globais.

Localização

frontend-react/src/stores/toastStore.ts

Estado

typescript
interface ToastState {
  toasts: Toast[];
  toast: {
    success: (message: string) => void;
    error: (message: string) => void;
    info: (message: string) => void;
    warning: (message: string) => void;
  };
  remove: (id: string) => void;
}

Uso

tsx
import { useToastStore } from './stores/toastStore';

const toast = useToastStore((s) => s.toast);

// Success
toast.success('Operação realizada!');

// Error
toast.error('Algo deu errado');

// Info
toast.info('Atualizando...');

// Warning
toast.warning('Atenção!')

Auto-remove

Toasts são removidos automaticamente após 3 segundos.

Lançado sob a licença MIT.