rename setCurrentUser to onUserUpdated

This commit is contained in:
ammarahm-ed
2022-03-16 13:21:05 +05:00
parent 90a728148d
commit d5b2aa2df1

View File

@@ -109,10 +109,10 @@ export const useAppEvents = () => {
EV.subscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded); EV.subscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);
EV.subscribe(EVENTS.attachmentsLoading, onLoadingAttachmentProgress); EV.subscribe(EVENTS.attachmentsLoading, onLoadingAttachmentProgress);
eSubscribeEvent('userLoggedIn', setCurrentUser); eSubscribeEvent('userLoggedIn', onUserUpdated);
return () => { return () => {
eUnSubscribeEvent('userLoggedIn', setCurrentUser); eUnSubscribeEvent('userLoggedIn', onUserUpdated);
EV.unsubscribe(EVENTS.userSessionExpired, onSessionExpired); EV.unsubscribe(EVENTS.userSessionExpired, onSessionExpired);
EV.unsubscribe(EVENTS.appRefreshRequested, onSyncComplete); EV.unsubscribe(EVENTS.appRefreshRequested, onSyncComplete);
EV.unsubscribe(EVENTS.databaseSyncRequested, onRequestPartialSync); EV.unsubscribe(EVENTS.databaseSyncRequested, onRequestPartialSync);
@@ -145,7 +145,7 @@ export const useAppEvents = () => {
if (url?.startsWith('https://app.notesnook.com/account/verified')) { if (url?.startsWith('https://app.notesnook.com/account/verified')) {
await onEmailVerified(); await onEmailVerified();
} }
await setCurrentUser(); await onUserUpdated();
} catch (e) {} } catch (e) {}
})(); })();
refValues.current.removeInternetStateListener = refValues.current.removeInternetStateListener =
@@ -288,8 +288,8 @@ export const useAppEvents = () => {
} }
}; };
const setCurrentUser = async login => { const onUserUpdated = async login => {
console.log(`setCurrentUser: ${login}`); console.log(`onUserUpdated: ${login}`);
let user; let user;
try { try {
user = await db.user.getUser(); user = await db.user.getUser();