feat: add event and check if user is logged in

This commit is contained in:
Zamitto 2024-06-19 12:07:33 -03:00
parent 6b03705d54
commit 17cfc7bb02
6 changed files with 21 additions and 3 deletions

View file

@ -86,9 +86,12 @@ export function App() {
dispatch(setProfileBackground(profileBackground));
}
/* TODO: Check if user is logged in before calling this */
fetchUserDetails().then((response) => {
if (response) setUserDetails(response);
window.electron.isUserLoggedIn().then((isLoggedIn) => {
if (isLoggedIn) {
fetchUserDetails().then((response) => {
if (response) setUserDetails(response);
});
}
});
}, [dispatch, fetchUserDetails]);

View file

@ -96,6 +96,7 @@ declare global {
/* Misc */
openExternal: (src: string) => Promise<void>;
isUserLoggedIn: () => Promise<boolean>;
getVersion: () => Promise<string>;
ping: () => string;
getDefaultDownloadsPath: () => Promise<string>;