Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/process/models/processManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ export class ProcessManager {
const selectedResponse = feedbackResponse.geocodingResponse.response.features[chosenResult];

const { endpoint, queryParams, headers } = this.appConfig.userDataService;
const fetchedUserData = await fetchUserDataService(endpoint, feedbackResponse.geocodingResponse.userId as string, queryParams, headers);
const userId = feedbackResponse.geocodingResponse.userId;

enrichedResponse.user = {
name: feedbackResponse.geocodingResponse.userId as string,
};
if (userId !== undefined) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (userId) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userId is string so eslint errors when you check for nullish.
Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly.eslint@typescript-eslint/strict-boolean-expressions

const fetchedUserData = await fetchUserDataService(endpoint, userId, queryParams, headers);

enrichedResponse.user = {
name: userId,
};

if (feedbackResponse.geocodingResponse.userId !== undefined && fetchedUserData[feedbackResponse.geocodingResponse.userId] !== null) {
const userData = fetchedUserData[feedbackResponse.geocodingResponse.userId];
const userData = fetchedUserData[userId] ?? fetchedUserData;
enrichedResponse.user = { ...enrichedResponse.user, ...userData };
}

Expand Down
Loading