TTikotok V4
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
} from '../services/backend/contracts';
|
||||
import { createIdempotencyKey } from '../utils/idempotency';
|
||||
import { AuthService, AuthSession } from '../services/authService';
|
||||
import { Analytics } from '../services/analytics';
|
||||
import { PlantsDb, SettingsDb, LexiconHistoryDb, AppMetaDb } from '../services/database';
|
||||
|
||||
interface AppState {
|
||||
@@ -301,6 +302,10 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||
const hydrateSession = useCallback(async (nextSession: AuthSession) => {
|
||||
setSession(nextSession);
|
||||
setProfileNameState(nextSession.name);
|
||||
Analytics.identify(nextSession.serverUserId, {
|
||||
email: nextSession.email,
|
||||
name: nextSession.name,
|
||||
});
|
||||
setIsLoadingPlants(true);
|
||||
setIsLoadingBilling(true);
|
||||
// The previous (guest or prior account) summary is meaningless for this
|
||||
@@ -362,6 +367,7 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||
|
||||
const signOut = useCallback(async () => {
|
||||
await AuthService.logout();
|
||||
Analytics.reset();
|
||||
resetStateForSignedOutUser();
|
||||
}, [resetStateForSignedOutUser]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user