31 lines
709 B
JavaScript
31 lines
709 B
JavaScript
export function useNotification() {
|
|
const showNotification = (options) => {
|
|
if (window.$notification) {
|
|
return window.$notification.create(options)
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
const success = () => {
|
|
|
|
}
|
|
|
|
const errorApi = (content = '', options = {}) => {
|
|
return showNotification(
|
|
{
|
|
title: 'Произошла ошибка',
|
|
description: 'При обращении к API серверу',
|
|
content,
|
|
meta: options.meta || new Date().toLocaleDateString(),
|
|
...options,
|
|
type: 'error'
|
|
}
|
|
)
|
|
}
|
|
|
|
return {
|
|
errorApi
|
|
}
|
|
}
|