Skip to content

Commit

Permalink
perf: added more notifications in debug console
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Oct 25, 2024
1 parent 6365e07 commit dfa7cf9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/renderer/stores/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { uidGen } from 'common/libs/uidGen';
import { defineStore } from 'pinia';

import { useConsoleStore } from './console';

export interface Notification {
uid: string;
status: string;
Expand All @@ -15,6 +17,13 @@ export const useNotificationsStore = defineStore('notifications', {
addNotification (payload: { status: string; message: string }) {
const notification: Notification = { uid: uidGen('N'), ...payload };
this.notifications.unshift(notification);

useConsoleStore().putLog('debug', {
level: notification.status,
process: 'renderer',
message: notification.message,
date: new Date()
});
},
removeNotification (uid: string) {
this.notifications = (this.notifications as Notification[]).filter(item => item.uid !== uid);
Expand Down

0 comments on commit dfa7cf9

Please sign in to comment.