Skip to content

Commit

Permalink
add home name to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
annastasiablack committed Jun 14, 2024
1 parent 79b7087 commit 83b1ca0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Fade from 'react-reveal/Fade';
import ManageTraining from './components/ManageTraining/ManageTraining';
import { isAdminUser } from './utils/AdminReportingRoles';
import NightMonitoring from './components/Forms/NightMonitoring';
import { FetchHomeData } from './utils/FetchHomeData';


const hideStyle = {
Expand Down Expand Up @@ -80,11 +81,17 @@ class App extends Component {
showMessageSent: false,
loading: false,
currentPage: 1,

homeName: "",
};



doGetHomeInfo = async () => {
try {
const { data } = await FetchHomeData(this.state.userObj.homeId);
this.state.homeName = data[0].name;
} catch (e) {
console.log("Error fetching home info");
}
};

doFetchFormApprovalCount = async () => {
try {
Expand Down Expand Up @@ -173,6 +180,7 @@ class App extends Component {
this.loadMessage(updatedUserData);
await this.getAllUsers();
await this.getMyMessages();
await this.doGetHomeInfo();
} catch (e) {
console.log(e);
await this.setState({
Expand Down Expand Up @@ -1174,6 +1182,9 @@ function DisplayExtra({
<h4 className='extraInfoMainTitle'>
{userObj.firstName + ' ' + userObj.lastName}
</h4>
<h5 className='extraInfoMainTitle'>
{appState.homeName}
</h5>
<h6 className='extraInfoSubTitle'>
{userObj.jobTitle.replace(/\//gm, ' ')}
</h6>
Expand Down

0 comments on commit 83b1ca0

Please sign in to comment.