use realtime account subscription with 10s fallback

This commit is contained in:
Harsh Mahajan
2025-10-01 16:25:24 +05:30
parent 3f7fbf8356
commit d5ef69cfdf
+11 -2
View File
@@ -9,6 +9,7 @@
import { base } from '$app/paths';
import { Dependencies } from '$lib/constants';
import { page } from '$app/state';
import { realtime } from '$lib/stores/sdk';
let sideBarIsOpen = writable(false);
let showAccountMenu = writable(false);
@@ -60,12 +61,20 @@
return;
}
const unsubscribe = realtime.forProject('', '').subscribe(['account'], async () => {
await invalidate(Dependencies.ACCOUNT);
checkEmailVerification();
});
const interval = setInterval(async () => {
await invalidate(Dependencies.ACCOUNT);
checkEmailVerification();
}, 2000);
}, 10000);
return () => clearInterval(interval);
return () => {
clearInterval(interval);
unsubscribe();
};
});
</script>