@@ -20,18 +20,26 @@ import {
2020 deleteRelease ,
2121 deprecatePackage ,
2222} from "../store/actions/adminActions" ;
23+ import ViewMalicousReports from "./viewMalicousReports" ;
2324import NoPage from "./404" ;
2425
2526const AdminSection = ( ) => {
2627 const uuid = useSelector ( ( state ) => state . auth . uuid ) ;
28+ const accessToken = useSelector ( ( state ) => state . auth . accessToken ) ;
2729 const dispatch = useDispatch ( ) ;
2830 const message = useSelector ( ( state ) => state . admin . message ) ;
2931 const statuscode = useSelector ( ( state ) => state . admin . statuscode ) ;
3032 const isAuthenticated = useSelector ( ( state ) => state . auth . isAuthenticated ) ;
3133 const isAdmin = useSelector ( ( state ) => state . admin . isAdmin ) ;
3234
35+ const [ showReports , setShowReports ] = useState ( false ) ;
36+
37+ const handleShowReports = ( value ) => {
38+ setShowReports ( value ) ;
39+ } ;
40+
3341 useEffect ( ( ) => {
34- dispatch ( adminAuth ( uuid ) ) ;
42+ dispatch ( adminAuth ( accessToken ) ) ;
3543 } , [ isAuthenticated , uuid ] ) ;
3644
3745 useEffect ( ( ) => {
@@ -207,10 +215,18 @@ const AdminSection = () => {
207215 // });
208216 // };
209217
210- return isAdmin ? (
218+ return isAdmin ? (
211219 < Container >
212- < br > </ br >
213220 < h2 style = { { textAlign : "left" } } > Admin Settings</ h2 >
221+ < div style = { { marginBottom : "8px" } } >
222+ < h4 > View Malicious Reports</ h4 >
223+ < Button
224+ style = { { fontSize : 16 } }
225+ onClick = { ( ) => handleShowReports ( true ) }
226+ >
227+ View Reports
228+ </ Button >
229+ </ div >
214230 < div >
215231 < h4 > Delete package</ h4 >
216232 < p style = { { textAlign : "left" } } >
@@ -361,6 +377,10 @@ const AdminSection = () => {
361377 Change Password
362378 </Button>
363379 </div> */ }
380+ < ViewMalicousReports
381+ show = { showReports }
382+ onHide = { ( ) => handleShowReports ( false ) }
383+ />
364384 < MDBModal show = { modalData . showModal } tabIndex = "-1" >
365385 < MDBModalDialog >
366386 < MDBModalContent >
@@ -386,7 +406,9 @@ const AdminSection = () => {
386406 </ MDBModalDialog >
387407 </ MDBModal >
388408 </ Container >
389- ) :( < NoPage /> ) ;
409+ ) : (
410+ < NoPage />
411+ ) ;
390412} ;
391413
392414export default AdminSection ;
0 commit comments