Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fe5381b

Browse files
committedMay 22, 2024·
handle null attributes
1 parent 1145612 commit fe5381b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎src/libs/ajax/User.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,12 @@ export const User = (signal?: AbortSignal) => {
199199
getSamUserCombinedState: async (): Promise<SamUserCombinedStateResponse> => {
200200
const res = await fetchSam('/api/user/v2/self/combinedState', _.mergeAll([authOpts(), { signal }]));
201201
const response = await res.json();
202-
response.terraUserAttributes = response.terraUserAttributes.map((attributes) => {
203-
const { userId: _, ...rest } = attributes;
204-
return rest;
205-
});
202+
if (response.terraUserAttributes !== null) {
203+
response.terraUserAttributes = response.terraUserAttributes.map((attributes) => {
204+
const { userId: _, ...rest } = attributes;
205+
return rest;
206+
});
207+
}
206208

207209
response.samUser.createdAt = response.samUser.createdAt ? new Date(response.samUser.createdAt) : undefined;
208210
response.samUser.registeredAt = response.samUser.registeredAt

0 commit comments

Comments
 (0)
Please sign in to comment.