feat: dispatching event when remote games are fetched

This commit is contained in:
Chubby Granny Chaser 2024-06-19 02:35:57 +01:00
parent ca81281f1f
commit 944f3891bf
No known key found for this signature in database
8 changed files with 31 additions and 17 deletions

View file

@ -81,6 +81,9 @@ export function App() {
window.electron.onSignIn(() => {
updateUser();
}),
window.electron.onLibraryBatchComplete(() => {
updateLibrary();
}),
window.electron.onSignOut(() => {
clearUser();
}),
@ -89,7 +92,7 @@ export function App() {
return () => {
listeners.forEach((unsubscribe) => unsubscribe());
};
}, [updateUser, clearUser]);
}, [updateUser, updateLibrary, clearUser]);
const handleSearch = useCallback(
(query: string) => {

View file

@ -73,6 +73,7 @@ declare global {
getGameByObjectID: (objectID: string) => Promise<Game | null>;
onPlaytime: (cb: (gameId: number) => void) => () => Electron.IpcRenderer;
onGameClose: (cb: (gameId: number) => void) => () => Electron.IpcRenderer;
onLibraryBatchComplete: (cb: () => void) => () => Electron.IpcRenderer;
/* User preferences */
getUserPreferences: () => Promise<UserPreferences | null>;
@ -111,7 +112,7 @@ declare global {
checkForUpdates: () => Promise<boolean>;
restartAndInstallUpdate: () => Promise<void>;
/* Authg */
/* Auth */
signOut: () => Promise<void>;
onSignIn: (cb: () => void) => () => Electron.IpcRenderer;
onSignOut: (cb: () => void) => () => Electron.IpcRenderer;