Persistence de l'UUID de conférence dans le localStorage
This commit is contained in:
parent
50ec72fcf4
commit
b36ae791cb
|
@ -3,7 +3,13 @@ import { WebrtcProvider, } from 'y-webrtc'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { uuidV4 } from '../util/uuid';
|
import { uuidV4 } from '../util/uuid';
|
||||||
|
|
||||||
const uuid = uuidV4();
|
const UUIDKey = 'conference-uuid';
|
||||||
|
let uuid = localStorage.getItem(UUIDKey);
|
||||||
|
|
||||||
|
if (!uuid) {
|
||||||
|
uuid = uuidV4();
|
||||||
|
localStorage.setItem(UUIDKey, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
export function useConference() {
|
export function useConference() {
|
||||||
const docRef = useRef(new Y.Doc());
|
const docRef = useRef(new Y.Doc());
|
||||||
|
|
Loading…
Reference in New Issue