Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const Header = () => {
<div className="post-user-name">
<p>{name}</p>
<small>
{user.specialism}, {user.cohort.title}
{user?.cohort?.title
? `${user.specialism}, ${user.cohort.title}`
: user.specialism}
</small>
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/profile/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const ProfilePage = () => {
role={tempCurrentUser?.role || ''}
specialism={tempCurrentUser?.specialism || ''}
cohort={tempCurrentUser?.cohort || ''}
startDate={tempCurrentUser?.cohort.startDate || ''}
endDate={tempCurrentUser?.cohort.endDate || ''}
startDate={tempCurrentUser?.cohort?.startDate || ''}
endDate={tempCurrentUser?.cohort?.endDate || ''}
isEditing={isEditing}
onChange={handleChange}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/profile/trainingInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ProfileTrainingInfo = ({
<TextInput
label="Cohort"
name="cohort"
value={cohort.title}
value={cohort?.title}
onChange={(e) => onChange('cohort', e.target.value)}
className={getInputClass('cohort', isEditing, user.cohort)}
disabled={!canEditField('cohort', isEditing, user.cohort)}
Expand Down
12 changes: 10 additions & 2 deletions src/pages/search/StudentSearchView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
</p>
{/* Empty cohorts get a random cohort to ensure nice formatting */}
<p>{u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}</p>
<p>
{u.cohort?.title
? `${u.specialism}, ${u.cohort?.title}`
: `${u.specialism}`}
</p>
</div>
<div style={{ cursor: 'pointer' }} onClick={() => navigate(`/profile/${u.id}`)}>
Profile
Expand All @@ -133,7 +137,11 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
</p>
{/* Empty cohorts get a random cohort to ensure nice formatting */}
<p>{u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}</p>
<p>
{u.cohort?.title
? `${u.specialism}, ${u.cohort?.title}`
: `${u.specialism}`}
</p>
</div>
</div>
<div
Expand Down
Loading