Skip to content

Commit

Permalink
Merge pull request #192 from GSG-G8/48-applicant-page
Browse files Browse the repository at this point in the history
fix accept button | Admin side  applicant page
  • Loading branch information
Asmaathabet authored Jun 9, 2020
2 parents 1b26636 + dd4295a commit 0f9caa8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
13 changes: 8 additions & 5 deletions client/src/components/pages/admin/Submitted_Id/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Card from '../../../common/card';
import Typography from '../../../common/Typography';
import Button from '../../../common/Button';
import backGround from '../../../../assets/images/backgroundDash.svg';
import DashBar from '../../../dashboard/Tabs';
import Alert from '../../../common/Alert';
import './index.css';

Expand All @@ -34,8 +33,9 @@ const SubmittedId = ({ location: { pathname } }) => {
const [data, setData] = useState();
const [Technical, setTechnical] = useState();
const [userId, setId] = useState('');
const [acceptedVal, setAcceptedVal] = useState();
const [acceptedVal, setAcceptedVal] = useState(false);
const [alertMsg, setAlertMsg] = useState([]);
const [loading, setLoading] = useState(false);
const history = useHistory();

useEffect(() => {
Expand All @@ -48,12 +48,12 @@ const SubmittedId = ({ location: { pathname } }) => {
setAcceptedVal(rows.accepted);
});
}

if (!Technical) getTec().then(setTechnical);
}, [data, Technical, pathname, userId, acceptedVal]);

return (
<>
<DashBar />
<div className="Container_page Extra_page_profile">
<Helmet>
<title>Application Profile</title>
Expand Down Expand Up @@ -584,9 +584,11 @@ const SubmittedId = ({ location: { pathname } }) => {
Go Back
</Button>
<Button
onClick={() => {
setAccept(userId, !acceptedVal);
onClick={async () => {
setLoading(true);
await setAccept(userId, !acceptedVal);
setAcceptedVal(!acceptedVal);
setLoading(false);
setAlertMsg([
...alertMsg,
acceptedVal ? (
Expand All @@ -596,6 +598,7 @@ const SubmittedId = ({ location: { pathname } }) => {
),
]);
}}
disabled={loading}
>
{acceptedVal ? 'Unaccept' : 'Accept'}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/pages/application/Steps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Steps = ({ userId, fullName }) => {
return (
<div className="Container_page">
<Helmet>
<title>Steps</title>
<title>Application Stseps</title>
</Helmet>

<img src={backGround} alt="backGround" className="backGround" />
Expand Down
1 change: 0 additions & 1 deletion server/controllers/applicant/updateApplicant.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const validationUpdate = require('../../utils/validation/applicantValidation');
const updateApplicant = (req, res, next) => {
const { id } = req.params;
const {
cohorts,
freeCodeCampPoints,
freeCodeCampTopics,
codeWarsKyu,
Expand Down

0 comments on commit 0f9caa8

Please sign in to comment.