Review changes

This commit is contained in:
Karl Ludwig Weise
2026-09-09 20:10:22 +02:00
parent 575845acad
commit d6facc7aba
2 changed files with 10 additions and 3 deletions
@@ -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) {