Skip to content

Commit

Permalink
Merge pull request #51288 from Expensify/dangrous-delegateforlogs
Browse files Browse the repository at this point in the history
Send `delegate` with every request if a user is logged in as one
  • Loading branch information
nkuoch authored Oct 25, 2024
2 parents 2947d2b + 4829919 commit 8b3405e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/libs/Network/enhanceParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ Onyx.connect({
},
});

// Check if the user is logged in as a delegate and send that if so
let delegate = '';
Onyx.connect({
key: ONYXKEYS.ACCOUNT,
callback: (val) => {
delegate = val?.delegatedAccess?.delegate ?? '';
},
});

/**
* Does this command require an authToken?
*/
Expand Down Expand Up @@ -57,5 +66,9 @@ export default function enhanceParameters(command: string, parameters: Record<st

finalParameters.clientUpdateID = lastUpdateIDAppliedToClient;

if (delegate) {
finalParameters.delegate = delegate;
}

return finalParameters;
}

0 comments on commit 8b3405e

Please sign in to comment.