Skip to content

Commit

Permalink
changed the named argument personalAccessToken to a cleaner one pat
Browse files Browse the repository at this point in the history
  • Loading branch information
PiusKariuki committed Jan 12, 2025
1 parent 0e5a364 commit ab1150f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/dhis2/src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Qs from 'qs';
* @param {object} axiosRequest - the axiosRequest contains valid axios params: https://axios-http.com/docs/req_config
* @returns {Promise} a promise that will resolve to either a response object or an error object.
*/
export function request({ username, password, personalAccessToken }, axiosRequest) {
export function request({ username, password, pat }, axiosRequest) {
const { method, url, params } = axiosRequest;

console.log(`Sending ${method} request to ${url}`);
Expand All @@ -26,8 +26,8 @@ export function request({ username, password, personalAccessToken }, axiosReques
const headers = { 'Content-Type': 'application/json'}
let auth;

if(personalAccessToken){
headers.Authorization = `ApiToken ${personalAccessToken}`
if(pat){
headers.Authorization = `ApiToken ${pat}`
} else {
auth = { username, password }
}
Expand Down

0 comments on commit ab1150f

Please sign in to comment.