From 11d89da4452fa6443afae5926cff6b530234c0d1 Mon Sep 17 00:00:00 2001 From: regularmute <93884347+Regularmute@users.noreply.github.com> Date: Thu, 2 May 2024 17:45:15 +0300 Subject: [PATCH] enable error messages through redux in instructor-logs page --- .../TimeLogsPage/InstructorTimeLogsPage.jsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/TimeLogsPage/InstructorTimeLogsPage.jsx b/frontend/src/components/TimeLogsPage/InstructorTimeLogsPage.jsx index 9d425b8..6001342 100644 --- a/frontend/src/components/TimeLogsPage/InstructorTimeLogsPage.jsx +++ b/frontend/src/components/TimeLogsPage/InstructorTimeLogsPage.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react' import { withRouter } from 'react-router-dom' - +import { connect } from 'react-redux' import { TimeLogsSelectForm } from './TimeLogsSelectForm' import { TimeLogRow } from './TimeLogRow' import LoadingSpinner from '../common/LoadingSpinner' @@ -11,7 +11,7 @@ import groupManagementService from '../../services/groupManagement' import instructorTimeLogsService from '../../services/instructorTimeLogs' import * as notificationActions from '../../reducers/actions/notificationActions' -const InstructorTimeLogsPage = () => { +const InstructorTimeLogsPage = (props) => { const [allConfigurations, setAllConfigurations] = useState([]) const [selectedConfiguration, setSelectedConfiguration] = useState(null) const [allGroups, setAllGroups] = useState([]) @@ -131,6 +131,15 @@ const InstructorTimeLogsPage = () => { ) } +const mapStateToProps = (state) => ({ + state: state, +}) + +const mapDispatchToProps = { + setError: notificationActions.setError, + setSuccess: notificationActions.setSuccess, +} + export default withRouter( - (InstructorTimeLogsPage) + connect(mapStateToProps, mapDispatchToProps)(InstructorTimeLogsPage) )