|
@@ -9,17 +9,36 @@ export class ImmichNotification {
|
|
|
id = new Date().getTime();
|
|
|
type!: NotificationType;
|
|
|
message!: string;
|
|
|
+ timeout = 3000;
|
|
|
}
|
|
|
|
|
|
+export class ImmichNotificationDto {
|
|
|
+ /**
|
|
|
+ * Notification type
|
|
|
+ * @type {NotificationType} [Info, Error]
|
|
|
+ */
|
|
|
+ type: NotificationType = NotificationType.Info;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Notification message
|
|
|
+ */
|
|
|
+ message = '';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Timeout in miliseconds
|
|
|
+ */
|
|
|
+ timeout = 3000;
|
|
|
+}
|
|
|
function createNotificationList() {
|
|
|
const notificationList = writable<ImmichNotification[]>([]);
|
|
|
|
|
|
- const show = ({ message = '', type = NotificationType.Info }) => {
|
|
|
- const notification = new ImmichNotification();
|
|
|
- notification.message = message;
|
|
|
- notification.type = type;
|
|
|
+ const show = (notificationInfo: ImmichNotificationDto) => {
|
|
|
+ const newNotification = new ImmichNotification();
|
|
|
+ newNotification.message = notificationInfo.message;
|
|
|
+ newNotification.type = notificationInfo.type;
|
|
|
+ newNotification.timeout = notificationInfo.timeout;
|
|
|
|
|
|
- notificationList.update((currentList) => [...currentList, notification]);
|
|
|
+ notificationList.update((currentList) => [...currentList, newNotification]);
|
|
|
};
|
|
|
|
|
|
const removeNotificationById = (id: number) => {
|