Skip to content

Commit

Permalink
Merge pull request #14 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING RELEASE branches
  • Loading branch information
dragos-dobre committed Apr 24, 2023
2 parents 6ecb53c + ff838f4 commit 525e6af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/MyProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ const MyProfilePage = (props) => {

let regions = [];
let districts = [];
const locations = user?.iUser.userdistrictSet;
const locations = user?.iUser?.userdistrictSet;

if (locations) {
locations.map((location) => {
districts.push(location.location.name);
if (!regions.includes(location.location.parent.name)) {
if (!!location.location.parent && !districts.includes(location.location)) {
districts.push(location.location.name);
}
if (!!location.location.parent && !regions.includes(location.location.parent.name)) {
regions.push(location.location.parent.name);
}
});
Expand Down Expand Up @@ -166,7 +168,7 @@ const MyProfilePage = (props) => {
module="profile"
label="language"
name="language"
value={user?.iUser.language.name}
value={user?.iUser?.language?.name}
variant="outlined"
readOnly={true}
/>
Expand All @@ -191,7 +193,7 @@ const MyProfilePage = (props) => {
</TableHead>
<TableBody>
{user &&
user.iUser.roles.map((role) => (
user?.iUser?.roles.map((role) => (
<TableRow key={role.name}>
<TableCell component="th" scope="row">
{role.name}
Expand Down

0 comments on commit 525e6af

Please sign in to comment.