refactor: better error handling

This commit is contained in:
zhom
2026-02-16 13:50:18 +04:00
parent bb8356eeef
commit 59706e62c1
7 changed files with 212 additions and 46 deletions
+9 -2
View File
@@ -32,12 +32,19 @@ export function useCloudAuth(): UseCloudAuthReturn {
useEffect(() => {
loadUser();
const unlistenPromise = listen("cloud-auth-expired", () => {
const unlistenExpired = listen("cloud-auth-expired", () => {
setAuthState(null);
});
const unlistenChanged = listen("cloud-auth-changed", () => {
loadUser();
});
return () => {
void unlistenPromise.then((unlisten) => {
void unlistenExpired.then((unlisten) => {
unlisten();
});
void unlistenChanged.then((unlisten) => {
unlisten();
});
};