use crypto api for uuid

This commit is contained in:
MathieuG-P
2022-12-25 22:33:32 +01:00
parent b9850effca
commit c8e4812967
5 changed files with 5 additions and 14 deletions
@@ -1,5 +1,4 @@
import { BehaviorSubject } from "rxjs";
import { v4 as uuidv4 } from 'uuid';
export class NotificationService{
@@ -17,7 +16,7 @@ export class NotificationService{
}
public notify(notification: Notification): Promise<NotificationResult|string>{
const resovableNotification: ResolvableNotification = {id: uuidv4(), notification, resolver: null };
const resovableNotification: ResolvableNotification = {id: crypto.randomUUID(), notification, resolver: null };
const promise = new Promise<NotificationResult|string>(resolve => {
resovableNotification.resolver = resolve;
setTimeout(() => resolve(NotificationResult.NO_CHOICE), notification.duration || 7000);