Skip to content

Commit

Permalink
Update caseWorkerUserDataCacheService.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
connorpgpmcelroy committed Jul 17, 2024
1 parent ef094a1 commit dc2d84b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions api/workAllocation/caseWorkerUserDataCacheService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export async function fetchNewUserData(): Promise<StaffUserDetails[]> {
refreshRoles = true;
await getAuthTokens();
// add the tokens to the request headers
const caseworkerHeaders = {
'content-type': 'application/json',
'serviceAuthorization': `Bearer ${initialServiceAuthToken}`,
'authorization': `Bearer ${initialAuthToken}`
};
const caseworkerHeaders = getRequestHeaders();
const jurisdictions = getConfigValue(STAFF_SUPPORTED_JURISDICTIONS);
cachedUsers = [];
const getUsersPath: string = prepareGetUsersUrl(baseCaseWorkerRefUrl, jurisdictions);
Expand Down Expand Up @@ -114,9 +110,7 @@ export async function fetchRoleAssignmentsForNewUsers(cachedUserData: StaffUserD
const jurisdictions = getStaffSupportedJurisdictionsList();
const payload = prepareRoleApiRequest(jurisdictions);
const roleAssignmentHeaders = {
'content-type': 'application/json',
'serviceAuthorization': `Bearer ${initialServiceAuthToken}`,
'authorization': `Bearer ${initialAuthToken}`,
...getRequestHeaders(),
pageNumber: 0,
size: 10000
};
Expand Down Expand Up @@ -177,6 +171,14 @@ export function timestampExists(): boolean {
return !!timestamp;
}

export function getRequestHeaders(): any {
return {
'content-type': 'application/json',
'serviceAuthorization': `Bearer ${initialServiceAuthToken}`,
'authorization': `Bearer ${initialAuthToken}`,
};
}

// get the request information from config - similarly in node-lib
export const getRequestBody = (): string => {
const userName = getConfigValue(SYSTEM_USER_NAME);
Expand Down

0 comments on commit dc2d84b

Please sign in to comment.