mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 17:53:55 +00:00
feat: prevent api calls when user is not logged in
This commit is contained in:
@@ -98,6 +98,8 @@ export function App() {
|
||||
fetchUserDetails().then((response) => {
|
||||
if (response) updateUserDetails(response);
|
||||
});
|
||||
} else {
|
||||
clearUserDetails();
|
||||
}
|
||||
});
|
||||
}, [fetchUserDetails, updateUserDetails, dispatch]);
|
||||
|
||||
@@ -57,8 +57,14 @@ export function useUserDetails() {
|
||||
);
|
||||
|
||||
const fetchUserDetails = useCallback(async () => {
|
||||
return window.electron.getMe();
|
||||
}, []);
|
||||
return window.electron.getMe().then((userDetails) => {
|
||||
if (userDetails == null) {
|
||||
clearUserDetails();
|
||||
}
|
||||
|
||||
return userDetails;
|
||||
});
|
||||
}, [clearUserDetails]);
|
||||
|
||||
const patchUser = useCallback(
|
||||
async (displayName: string, imageProfileUrl: string | null) => {
|
||||
|
||||
Reference in New Issue
Block a user