Skip to content

Commit

Permalink
fix: added optional chaining operator
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavanakarwade committed Dec 11, 2024
1 parent e02ea8d commit a7d39bd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/components/Profile/DisplayUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const DisplayUser = () => {
let timer:any= null
const getUserDetails = async () => {
const userProfile = await getFromLocalStorage(storageKeys.USER_PROFILE)
console.log("🚀 ~ getUserDetails ~ userProfile11111111111:", userProfile)
const orgRoles = await getFromLocalStorage(storageKeys.ORG_ROLES)
userProfile.roles = orgRoles;
setUserObj(userProfile);
Expand Down
2 changes: 1 addition & 1 deletion src/components/User/UserDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ const UserDashBoard = () => {

const setOrgRoleDetails = async (org: Organisation) => {
await setToLocalStorage(storageKeys.ORG_ID, org.id.toString());
const roles: string[] = org?.userOrgRoles.map((role) => role.orgRole.name);
const roles: string[] = org?.userOrgRoles?.map((role) => role.orgRole.name);

await setToLocalStorage(storageKeys.ORG_ROLES, roles.toString());

Expand Down
2 changes: 1 addition & 1 deletion src/components/organization/OrgDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const OrgDropDown = () => {
} else if (organizations?.[0]) {
activeOrgDetails = organizations?.[0];
const roles: string[] = activeOrgDetails?.userOrgRoles?.map(
(role: { orgRole: { name: string } }) => role.orgRole.name,
(role: { orgRole: { name: string } }) => role?.orgRole?.name,
);
const { id, name, description, logoUrl } = organizations[0] || {};
const orgInfo = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/organization/OrganizationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const OrganizationsList = () => {

await setToLocalStorage(storageKeys.ORG_ID, activeOrg.id.toString());
const roles: string[] = activeOrg?.userOrgRoles.map(
(role) => role.orgRole.name,
(role) => role?.orgRole?.name,
);
const { id, name, description, logoUrl } = activeOrg || {};
const orgInfo = {
Expand Down

0 comments on commit a7d39bd

Please sign in to comment.