Skip to content

Commit

Permalink
Merge pull request #64 from FAC-Sixteen/Feature/student-signup
Browse files Browse the repository at this point in the history
Feature/student signup
  • Loading branch information
rymatech authored Jun 13, 2019
2 parents 1dfd334 + 898da24 commit 04e0b50
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import './StudentSignup.css';
import './StudentSignupForm.css';
import axios from 'axios';

function StudentSignup() {
function StudentSignupForm() {
const [data, setData] = useState({firstName:"", lastName: "", email: "",
phoneNumber: "", password: "", university: "", yearOfStudy: "",
courseStudied: "", aboutYou: "", LinkedinURL: ""});
Expand All @@ -15,20 +15,19 @@ function StudentSignup() {

const handleSubmit = (event) => {
event.preventDefault();
console.log(data)
// const addStudent = async () => {
// console.log(`Fake submitting: ${data}`);
// try {
// return await
// axios.post('/api/student/create', this.data)
// } catch(error) {
// console.error(error)
// }
// }
// addStudent();
// props.history.push('/dashboard');
setData({firstName:"", lastName: "", email: "", //clear form on submit
phoneNumber: null, password: "", university: "", yearOfStudy: 0,

const addStudent = async () => {
console.log(`Fake submitting: ${data}`);
try {
return await
axios.post('/api/student/sign-up', data)
} catch(error) {
console.error(error)
}
}
addStudent();
setData({firstName:"", lastName: "", email: "", //clear form on submit
phoneNumber: "", password: "", university: "", yearOfStudy: "",
courseStudied: "", aboutYou: "", LinkedinURL: ""});
}

Expand Down Expand Up @@ -111,4 +110,4 @@ function StudentSignup() {
)
}

export default StudentSignup;
export default StudentSignupForm;
3 changes: 2 additions & 1 deletion src/routes/StudentSignup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { Component } from "react";
import StudentSignupForm from '../components/StudentSignupForm/StudentSignupForm.js'

const StudentSignup = () => {
return (
<div>
<h1>StudentSignup Page</h1>
<StudentSignupForm />
</div>
);
};
Expand Down

0 comments on commit 04e0b50

Please sign in to comment.