Skip to content

Commit

Permalink
fix(hub-common): make getUser optional (#1722)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannaeapicella authored Nov 8, 2024
1 parent af7a95f commit b3531bd
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 74 deletions.
122 changes: 61 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getUser } from "@esri/arcgis-rest-portal";
import { getUser, IUser } from "@esri/arcgis-rest-portal";
import { IHubSearchOptions } from "../../types/IHubSearchOptions";
import { IHubSearchResult } from "../../types/IHubSearchResult";
import { IEvent } from "../../../events/api/orval/api/orval-events";
Expand All @@ -17,10 +17,13 @@ export async function eventToSearchResult(
event: IEvent,
options: IHubSearchOptions
): Promise<IHubSearchResult> {
const ownerUser = await getUser({
username: event.creator.username,
...options.requestOptions,
});
let ownerUser: IUser;
if (options.include?.includes("ownerUser")) {
ownerUser = await getUser({
username: event.creator.username,
...options.requestOptions,
});
}
const result = {
access: event.access.toLowerCase() as AccessLevel,
id: event.id,
Expand Down
Loading

0 comments on commit b3531bd

Please sign in to comment.