Skip to content

Commit

Permalink
DRYing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldoglas committed Mar 4, 2024
1 parent 6fd8978 commit 992ed3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libs/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import HttpUtils from './HttpUtils';
import type Middleware from './Middleware/types';
import enhanceParameters from './Network/enhanceParameters';
import * as NetworkStore from './Network/NetworkStore';
import { isSupportalToken } from './actions/Session';
import { isSupportAuthToken } from './actions/Session';

let middlewares: Middleware[] = [];

Expand All @@ -13,7 +13,7 @@ function makeXHR(request: Request): Promise<Response | void> {
return NetworkStore.hasReadRequiredDataFromStorage().then((): Promise<Response | void> => {
// If we're using the Supportal token and this is not a Supportal request
// let's just return a promise that will resolve itself.
if (isSupportalToken() && !NetworkStore.isSupportRequest(request.command)) {
if (isSupportAuthToken() && !NetworkStore.isSupportRequest(request.command)) {
return new Promise<void>((resolve) => {
resolve();
});
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ function getShortLivedLoginParams() {
},
];

// Subsequently, we revert it back to the default value of 'signedInWithShortLivedAuthToken' in 'successData' or 'failureData' to ensure the user is logged out on refresh
// We are combining both success and failure data params into one const as they are identical
// Subsequently, we revert it back to the default value of 'signedInWithShortLivedAuthToken' in 'finallyData' to ensure the user is logged out on refresh
const finallyData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down

0 comments on commit 992ed3a

Please sign in to comment.