mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-27 03:14:48 +02:00
Review changes
This commit is contained in:
@@ -52,10 +52,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
const decryptPayload = async () => {
|
||||
const decryptPayload = async (retry = true) => {
|
||||
if (item.metaData?.encryptedPayload) {
|
||||
if (!$staffCrypto.isAuthenticated || !$staffCrypto.crypto) {
|
||||
const maxWaitTime = 5000; // 5 seconds
|
||||
const maxWaitTime = 5000;
|
||||
const startTime = Date.now();
|
||||
|
||||
while (!$staffCrypto.isAuthenticated && Date.now() - startTime < maxWaitTime) {
|
||||
@@ -63,6 +63,13 @@
|
||||
}
|
||||
|
||||
if (!$staffCrypto.isAuthenticated || !$staffCrypto.crypto) {
|
||||
const user = $auth.user;
|
||||
if (retry && user && user.tenantId) {
|
||||
console.warn("Staff crypto not initialized, retrying notification item decryption...");
|
||||
await staffCrypto.authenticateAndWait(user.id, user.tenantId);
|
||||
decryptPayload(false);
|
||||
return;
|
||||
}
|
||||
console.error("Staff crypto not initialized after waiting");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
// Wait for crypto to be initialized (max 5 seconds)
|
||||
if (!$staffCrypto.isAuthenticated || !$staffCrypto.crypto) {
|
||||
const maxWaitTime = 2000;
|
||||
const maxWaitTime = 5000;
|
||||
const startTime = Date.now();
|
||||
|
||||
while (!$staffCrypto.isAuthenticated && Date.now() - startTime < maxWaitTime) {
|
||||
|
||||
Reference in New Issue
Block a user