diff --git a/euphoria-frontend/src/App.js b/euphoria-frontend/src/App.js index 2fe99d2..3da9111 100644 --- a/euphoria-frontend/src/App.js +++ b/euphoria-frontend/src/App.js @@ -26,14 +26,14 @@ class App extends Component {
- ()} /> + ()} /> - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + ()} /> + ()} /> diff --git a/euphoria-frontend/src/views/Apply.jsx b/euphoria-frontend/src/views/Apply.jsx index ec120de..6fe9743 100644 --- a/euphoria-frontend/src/views/Apply.jsx +++ b/euphoria-frontend/src/views/Apply.jsx @@ -16,7 +16,7 @@ class Apply extends Component { componentDidMount() { let url = "http://localhost:8080/api/posting/" + this.props.match.params.postingId; - console.log(this.props); + this.handleGet(url); } @@ -110,7 +110,7 @@ class Apply extends Component { this.handleRedirect("/posting")} + onClick={() => this.handleRedirect("/postings")} />
diff --git a/euphoria-frontend/src/views/Dashboard.jsx b/euphoria-frontend/src/views/Dashboard.jsx index 6809db7..60e059c 100644 --- a/euphoria-frontend/src/views/Dashboard.jsx +++ b/euphoria-frontend/src/views/Dashboard.jsx @@ -5,7 +5,7 @@ class Dashboard extends Component { constructor(props, context) { super(props); - this.dashboardUrl = "http://localhost:8080/api/posting/company/" + this.props.cookies.get("id"); + this.dashboardUrl = "http://localhost:8080/api/posting/company/" + this.props.cookies.get("id") this.state = { companyPostingsData: [], diff --git a/euphoria-frontend/src/views/Signin.jsx b/euphoria-frontend/src/views/Signin.jsx index e5f730a..3def626 100644 --- a/euphoria-frontend/src/views/Signin.jsx +++ b/euphoria-frontend/src/views/Signin.jsx @@ -63,15 +63,15 @@ class Signin extends Component { .then(data => { const cookie = data[0]; - if(cookie != null){ - const cookies = this.props.cookies; + if(!(cookie == null)){ + const cookiesProp = this.props.cookies; - cookies.set("username", username, { path: '/' }); - cookies.set("id", cookies.id, { path: '/' }); - cookies.set("isUser", cookies.isUser, { path: '/' }); - cookies.set("authenticationHash", cookie.cookie, { path: '/' }); + cookiesProp.set("username", username, { path: '/' }); + cookiesProp.set("id", cookie.id, { path: '/' }); + cookiesProp.set("isUser", cookie.isUser, { path: '/' }); + cookiesProp.set("authenticationHash", cookie.cookie, { path: '/' }); - if(cookies.isUser){ + if(cookie.isUser){ this.handleRedirect("/postings") } else{ diff --git a/euphoria-frontend/src/views/Signup.jsx b/euphoria-frontend/src/views/Signup.jsx index 2305ed8..eac1a3d 100644 --- a/euphoria-frontend/src/views/Signup.jsx +++ b/euphoria-frontend/src/views/Signup.jsx @@ -94,6 +94,7 @@ class Signup extends Component { website, description }; + console.log(userPayload) } fetch(userUrl, { @@ -101,14 +102,16 @@ class Signup extends Component { body: JSON.stringify(userPayload) }) //FIXME add check for is user exists .then(response => response.json()) - .then(data => this.createUserAuthentication(data[0].userId)) + .then(data => { + this.createUserAuthentication((isUser) ? data[0].userId : data[0].companyId) + }) .catch(err => { }) return; } - createUserAuthentication(userId) { + createUserAuthentication(id) { const { isUser, username, @@ -118,12 +121,14 @@ class Signup extends Component { const authenticationUrl = "http://localhost:8080/api/authentication"; let authenticationPayload = { - id: userId, + id: id, username: username, passwordHash: password, isUser: isUser }; + console.log(authenticationPayload); + fetch(authenticationUrl, { method: "POST", body: JSON.stringify(authenticationPayload) @@ -234,7 +239,7 @@ class Signup extends Component { - Email + Website