Sha256: 20cc927c96905161205b0a624f290f7bca974fe5f8377f572f6756cfcfd358c4
Contents?: true
Size: 629 Bytes
Versions: 3
Compression:
Stored size: 629 Bytes
Contents
import { create } from "zustand"; export interface Toast { type: string, message: string } interface ToastState { toasts: Toast[], error: (msg: string) => void, notice: (msg: string) => void, next: () => void } const useToastStore = create<ToastState>((set) => ({ toasts: [], error: (msg: string) => set((state) => ( { toasts: [...state.toasts, { message: msg, type: "error" }] } )), notice: (msg: string) => set((state) => ( { toasts: [...state.toasts, { message: msg, type: "notice" }] } )), next: () => set((state) => ({ toasts: state.toasts.slice(1) })) })); export default useToastStore;
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.12.4 | app/javascript/stores/useToastStore.ts |
pages_core-3.12.3 | app/javascript/stores/useToastStore.ts |
pages_core-3.12.2 | app/javascript/stores/useToastStore.ts |