Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Link and form redirects #116

Merged
merged 2 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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