Changeset befb988 for jobvista-frontend/src/views/admin_panel
- Timestamp:
- 06/17/24 21:59:14 (5 months ago)
- Branches:
- main
- Children:
- 08f82ec
- Parents:
- b248810
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
jobvista-frontend/src/views/admin_panel/AdminPanel.js
rb248810 rbefb988 4 4 import {useState, useEffect} from "react"; 5 5 import {AdminActions} from "../../redux/actions/adminActions"; 6 import {notifyAccessUpdate} from "../../utils/toastUtils"; 6 7 7 8 export const AdminPanel = () => { … … 24 25 setRecruiters(recruitersState) 25 26 console.log("Fetch all recruiters STATE") 27 console.log(recruitersState) 28 26 29 } 27 30 }, [recruitersState]) … … 32 35 }; 33 36 34 const handleAccessChange = (recruiterId, newAccessStatus) => { 37 const handleAccessChange = (recruiterId, companyName, newAccessStatus) => { 38 35 39 setRecruiters(prevState => 36 40 prevState.map(recruiter => … … 41 45 ); 42 46 43 console.log(recruiterId + " " + newAccessStatus)44 45 47 dispatch(AdminActions.changeAccess(recruiterId, newAccessStatus, (success, response) => { 46 48 if(success) { 47 console.log("Access changed")49 notifyAccessUpdate(companyName) 48 50 } 49 51 })); … … 51 53 52 54 return ( 53 <div className=" applications-container mt-5">55 <div className="custom-container mt-5"> 54 56 <table className="table table-striped"> 55 57 <thead> … … 64 66 </thead> 65 67 <tbody> 66 {recruiters .map((recruiter) => (68 {recruitersState.map((recruiter) => ( 67 69 <tr key={recruiter.id}> 68 70 <th scope="row">{recruiter.id}</th> … … 70 72 <td>{recruiter.email}</td> 71 73 <td>{recruiter.companyName}</td> 72 <td>{recruiter. phoneNumber}</td>74 <td>{recruiter.contactPhoneNumber}</td> 73 75 <td> 74 76 <label className="switch"> … … 76 78 type="checkbox" 77 79 checked={recruiter.hasAccess} 78 onChange={(e) => handleAccessChange(recruiter.id, e.target.checked)}80 onChange={(e) => handleAccessChange(recruiter.id, recruiter.companyName, e.target.checked)} 79 81 /> 80 82 <span className="slider"></span>
Note:
See TracChangeset
for help on using the changeset viewer.