Skip to content

Commit dd9c8f5

Browse files
authored
Merge pull request #9961 from Expensify/marcaaron-fixPusherReauthenticationIssue
Return `data` from `Reauthentication` middleware when `shouldRetry: false`
2 parents 13d2766 + 273fe2d commit dd9c8f5

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/components/TestToolMenu.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import * as Network from '../libs/actions/Network';
99
import * as Session from '../libs/actions/Session';
1010
import ONYXKEYS from '../ONYXKEYS';
1111
import Button from './Button';
12-
import * as NetworkStore from '../libs/Network/NetworkStore';
1312
import TestToolRow from './TestToolRow';
1413
import networkPropTypes from './networkPropTypes';
1514
import compose from '../libs/compose';
@@ -60,7 +59,7 @@ const TestToolMenu = props => (
6059
<Button
6160
small
6261
text="Invalidate"
63-
onPress={() => NetworkStore.setAuthToken('pizza')}
62+
onPress={() => Session.invalidateAuthToken()}
6463
/>
6564
</TestToolRow>
6665

src/libs/Middleware/Reauthentication.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Reauthentication(response, request, isFromSequentialQueue) {
4242
if (request.resolve) {
4343
request.resolve(data);
4444
}
45-
return;
45+
return data;
4646
}
4747

4848
// We are already authenticating

src/libs/actions/Session/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ function invalidateCredentials() {
343343
Onyx.merge(ONYXKEYS.CREDENTIALS, {autoGeneratedLogin: '', autoGeneratedPassword: ''});
344344
}
345345

346+
function invalidateAuthToken() {
347+
NetworkStore.setAuthToken('pizza');
348+
Onyx.merge(ONYXKEYS.SESSION, {authToken: 'pizza'});
349+
}
350+
346351
/**
347352
* Clear the credentials and partial sign in session so the user can taken back to first Login step
348353
*/
@@ -520,4 +525,5 @@ export {
520525
setShouldShowComposeInput,
521526
changePasswordAndSignIn,
522527
invalidateCredentials,
528+
invalidateAuthToken,
523529
};

src/pages/settings/PreferencesPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const PreferencesPage = (props) => {
101101
</View>
102102

103103
{/* If we are in the staging environment then we enable additional test features */}
104-
{props.environment === CONST.ENVIRONMENT.STAGING && <TestToolMenu />}
104+
{_.contains([CONST.ENVIRONMENT.STAGING, CONST.ENVIRONMENT.DEV], props.environment) && <TestToolMenu />}
105105
</View>
106106
</ScrollView>
107107
</ScreenWrapper>

0 commit comments

Comments
 (0)