fix: ensure unique ID generation for ICalSubscription in useCalendarStore
This commit is contained in:
@@ -622,7 +622,9 @@ export const useCalendarStore = create<CalendarStore>()(
|
|||||||
if (!calendar) throw new Error('Failed to create calendar');
|
if (!calendar) throw new Error('Failed to create calendar');
|
||||||
|
|
||||||
const subscription: ICalSubscription = {
|
const subscription: ICalSubscription = {
|
||||||
id: crypto.randomUUID(),
|
id: typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
|
||||||
|
? crypto.randomUUID()
|
||||||
|
: `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`,
|
||||||
url,
|
url,
|
||||||
calendarId: calendar.id,
|
calendarId: calendar.id,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Reference in New Issue
Block a user