Skip to content

Commit

Permalink
Merge pull request #116 from FAC-Sixteen/Feature/navigation
Browse files Browse the repository at this point in the history
Add Link and form redirects
  • Loading branch information
Dalmano authored Jun 20, 2019
2 parents c95094a + 41da675 commit 2e7cd1b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
10 changes: 6 additions & 4 deletions src/components/Homepage/Founders/Founders.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import "./Founders.css";
import Founder from "./Founder/Founder";
import { Link } from "react-router-dom";
import { Link } from 'react-router-dom';


const Founders = () => {
return (
Expand Down Expand Up @@ -36,9 +37,10 @@ const Founders = () => {
out to find a solution, which led us to Groundworks. Our way to
revolutionise how companies connect with students worldwide.
</p>

<Link to={"/Join"}>
<button className="FoundersComponent--joinbutton">Join</button>
<Link to='/Join'>
<button className="FoundersComponent--joinbutton">
Join
</button>
</Link>
</div>
);
Expand Down
25 changes: 19 additions & 6 deletions src/components/LoginRegister/RegisterPortal/RegisterPortal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from "react";
import {withRouter} from 'react-router-dom'
import "./RegisterPortal.css";
import axios from "axios";

const RegisterPortal = () => {
const [user, setUser] = useState("");

const RegisterPortal = (props) => {
const [user, setUser] = useState("");
const [redirect, setRedirect] = useState(false);
const [data, setData] = useState({
userName: "",
email: "",
Expand All @@ -22,13 +24,18 @@ const RegisterPortal = () => {

const handleSubmit = e => {
e.preventDefault();
setRedirect(!redirect);
console.log(data);
console.log(user);

console.log(props);
const addRegister = async () => {
console.log(`Fake submitting: ${data}`);
try {
return await axios.post(`/api/${user}/join`, data);
const response = await axios.post(`/api/${user}/join`, data);
if(response.status === 200 ) // check if response status is ok
{props.history.push('/StudentSignup')
//success scenario
}
} catch (error) {
console.error(error);
}
Expand All @@ -43,7 +50,13 @@ const RegisterPortal = () => {
password: "",
userType: ""
});
};
}

// render() {
// if (redirect === true) {
// return <Redirect to='/StudentSignup' />
// }
// }

return (
<div>
Expand Down Expand Up @@ -112,4 +125,4 @@ const RegisterPortal = () => {
);
};

export default RegisterPortal;
export default withRouter(RegisterPortal);
14 changes: 10 additions & 4 deletions src/components/NewBrief/NewBriefForm/NewBriefForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ const ClientNewBriefForm = () => {
projectName: "",
projectBrief: "",
projectDeadline: "",
estimatedWorkload: "",
projectPrice: "",
estimatedWorkload: 0,
projectPrice: 0,
additionalInfo: "",
studentSkills: "",
additionalInfo: ""
// jobClient: "5d08cff93136b6429a9c01eb",
client: "testing"
// jobType: "new"

});

const handleChange = event => {
Expand Down Expand Up @@ -43,7 +47,9 @@ const ClientNewBriefForm = () => {
estimatedWorkload: "",
projectPrice: "",
studentSkills: "",
additionalInfo: ""
additionalInfo: "",
// jobType: "new",
client: "5d08cff93136b6429a9c01eb"
});
};
return (
Expand Down

0 comments on commit 2e7cd1b

Please sign in to comment.