mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-16 21:46:32 +00:00
15 lines
516 B
TypeScript
15 lines
516 B
TypeScript
import Notifications, { NotificationsOptions, notify } from '@kyvg/vue3-notification';
|
|
|
|
export const notifications = Notifications;
|
|
|
|
function notifyError(err: unknown, args: NotificationsOptions | string = {}): void {
|
|
// eslint-disable-next-line no-console
|
|
console.error(err);
|
|
|
|
const mArgs = typeof args === 'string' ? { title: args } : args;
|
|
const title = mArgs?.title || (err as Error)?.message || `${err}`;
|
|
|
|
notify({ type: 'error', ...mArgs, title });
|
|
}
|
|
|
|
export default () => ({ notify, notifyError });
|