Добавлен сервис уведомлений
This commit is contained in:
30
resources/js/Composables/useNotification.js
Normal file
30
resources/js/Composables/useNotification.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user