Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
let isHybridAppSetupFinished = false;
let hasSwitchedAccountInHybridMode = false;

Onyx.connect({

Check warning on line 79 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
session = value ?? {};
Expand All @@ -93,37 +93,37 @@
},
});

Onyx.connect({

Check warning on line 96 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.USER_METADATA,
callback: Fullstory.consentAndIdentify,
});

let stashedSession: Session = {};
Onyx.connect({

Check warning on line 102 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_SESSION,
callback: (value) => (stashedSession = value ?? {}),
});

let credentials: Credentials = {};
Onyx.connect({

Check warning on line 108 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CREDENTIALS,
callback: (value) => (credentials = value ?? {}),
});

let stashedCredentials: Credentials = {};
Onyx.connect({

Check warning on line 114 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_CREDENTIALS,
callback: (value) => (stashedCredentials = value ?? {}),
});

let preferredLocale: Locale | null = null;
Onyx.connect({

Check warning on line 120 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_PREFERRED_LOCALE,
callback: (val) => (preferredLocale = val ?? null),
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 126 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (newActivePolicyID) => {
activePolicyID = newActivePolicyID;
Expand Down Expand Up @@ -329,7 +329,7 @@
}

// Wait for signOut (if called), then redirect and update Onyx.
signOutPromise
return signOutPromise
.then((response) => {
if (response?.hasOldDotAuthCookies) {
Log.info('Redirecting to OldDot sign out');
Expand Down Expand Up @@ -362,7 +362,9 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function callFunctionIfActionIsAllowed<TCallback extends ((...args: any[]) => any) | void>(callback: TCallback, isAnonymousAction = false): TCallback | (() => void) {
if (isAnonymousUser() && !isAnonymousAction) {
return () => signOutAndRedirectToSignIn();
return () => {
signOutAndRedirectToSignIn();
}
}
return callback;
}
Expand Down
9 changes: 3 additions & 6 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
const signOut = useCallback(
(shouldForceSignout = false) => {
if (!network.isOffline || shouldForceSignout) {
signOutAndRedirectToSignIn();
return;
return signOutAndRedirectToSignIn();
}

// When offline, warn the user that any actions they took while offline will be lost if they sign out
Expand Down Expand Up @@ -285,7 +284,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
translationKey: signOutTranslationKey,
icon: Expensicons.Exit,
action: () => {
signOut(false);
return signOut(false);
},
},
],
Expand Down Expand Up @@ -338,9 +337,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
icon={item.icon}
iconType={item.iconType}
disabled={isExecuting}
onPress={singleExecution(() => {
item.action();
})}
onPress={singleExecution(item.action)}
iconStyles={item.iconStyles}
badgeText={item.badgeText}
badgeStyle={item.badgeStyle}
Expand Down
Loading