import type { NotificationOptions } from 'naive-ui'; /** * Обёртка над discrete notification API NaiveUI с удобными хелперами. * Перенесено и упрощено из проекта onboard (Composables/useNotification.js). */ export function useNotification() { const showNotification = (options: NotificationOptions) => { return window.$notification?.create(options) ?? null; }; const success = ( title: string, description = '', options: Partial = {}, ) => { return showNotification({ title, description, meta: options.meta ?? new Date().toLocaleDateString(), ...options, type: 'success', }); }; const error = ( title = 'Произошла ошибка', description = '', options: Partial = {}, ) => { return showNotification({ title, description, meta: options.meta ?? new Date().toLocaleDateString(), ...options, type: 'error', }); }; return { success, error }; }