[bug] prevent caching "undefined" as user pairingId
This commit is contained in:
parent
76db507654
commit
b3090febca
@ -294,13 +294,20 @@ export default function DashboardPage() {
|
|||||||
let pairingId = userStore.getUserPairingId();
|
let pairingId = userStore.getUserPairingId();
|
||||||
|
|
||||||
// 1️⃣ Créer le pairing si non existant
|
// 1️⃣ Créer le pairing si non existant
|
||||||
if (!pairingId) {
|
if (!pairingId || pairingId === 'undefined' || pairingId === 'null') {
|
||||||
console.log("🚀 No pairing found — creating new pairing...");
|
// We may have a pairing id but the value is not in cache for some reason
|
||||||
pairingId = await messageBus.createUserPairing();
|
pairingId = await messageBus.getUserPairingId();
|
||||||
console.log("✅ Pairing created:", pairingId);
|
if (pairingId) {
|
||||||
|
userStore.pair(pairingId);
|
||||||
|
setUserPairingId(pairingId);
|
||||||
|
} else {
|
||||||
|
console.log("🚀 No pairing found — creating new pairing...");
|
||||||
|
pairingId = await messageBus.createUserPairing();
|
||||||
|
console.log("✅ Pairing created:", pairingId);
|
||||||
|
|
||||||
userStore.pair(pairingId);
|
userStore.pair(pairingId);
|
||||||
setUserPairingId(pairingId);
|
setUserPairingId(pairingId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("🔗 Already paired with ID:", pairingId);
|
console.log("🔗 Already paired with ID:", pairingId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,9 @@ export default class UserStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public pair(userPairingId: string): void {
|
public pair(userPairingId: string): void {
|
||||||
|
if (!userPairingId || userPairingId === 'undefined' || userPairingId === 'null') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
sessionStorage.setItem('userPairingId', userPairingId);
|
sessionStorage.setItem('userPairingId', userPairingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user