This repository was archived by the owner on Jul 12, 2019. It is now read-only.
File tree 5 files changed +26
-21
lines changed
5 files changed +26
-21
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,14 @@ class App extends Component {
26
26
< div >
27
27
< Switch >
28
28
< Route exact path = "/" component = { Splash } />
29
- < Route path = "/signin" render = { ( props ) => ( < Signin { ...props } /> ) } />
29
+ < Route path = "/signin" render = { ( props ) => ( < Signin cookies = { this . props . cookies } { ...props } /> ) } />
30
30
< Route path = "/signup" component = { Signup } />
31
- < Route exact path = "/postings" render = { ( props ) => ( < Postings { ...props } /> ) } />
32
- < Route path = "/postings/apply/:postingId" render = { ( props ) => ( < Apply { ...props } /> ) } />
33
- < Route exact path = "/dashboard" render = { ( props ) => ( < Dashboard { ...props } /> ) } />
34
- < Route exact path = "/dashboard/post" render = { ( props ) => ( < Post { ...props } /> ) } />
35
- < Route path = "/dashboard/post/edit/:postingId" render = { ( props ) => ( < Editpost { ...props } /> ) } />
36
- < Route path = "/dashboard/applications/:postingId" render = { ( props ) => ( < Applications { ...props } /> ) } />
31
+ < Route exact path = "/postings" render = { ( props ) => ( < Postings cookies = { this . props . cookies } { ...props } /> ) } />
32
+ < Route path = "/postings/apply/:postingId" render = { ( props ) => ( < Apply cookies = { this . props . cookies } { ...props } /> ) } />
33
+ < Route exact path = "/dashboard" render = { ( props ) => ( < Dashboard cookies = { this . props . cookies } { ...props } /> ) } />
34
+ < Route exact path = "/dashboard/post" render = { ( props ) => ( < Post cookies = { this . props . cookies } { ...props } /> ) } />
35
+ < Route path = "/dashboard/post/edit/:postingId" render = { ( props ) => ( < Editpost cookies = { this . props . cookies } { ...props } /> ) } />
36
+ < Route path = "/dashboard/applications/:postingId" render = { ( props ) => ( < Applications cookies = { this . props . cookies } { ...props } /> ) } />
37
37
< Route path = "/404" component = { NotFound } />
38
38
< Redirect to = "/404" />
39
39
</ Switch >
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class Apply extends Component {
16
16
17
17
componentDidMount ( ) {
18
18
let url = "http://localhost:8080/api/posting/" + this . props . match . params . postingId ;
19
- console . log ( this . props ) ;
19
+
20
20
this . handleGet ( url ) ;
21
21
}
22
22
@@ -110,7 +110,7 @@ class Apply extends Component {
110
110
< Image
111
111
src = { require ( '../images/Logo.png' ) }
112
112
fluid
113
- onClick = { ( ) => this . handleRedirect ( "/posting " ) }
113
+ onClick = { ( ) => this . handleRedirect ( "/postings " ) }
114
114
/>
115
115
</ div >
116
116
</ div >
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class Dashboard extends Component {
5
5
constructor ( props , context ) {
6
6
super ( props ) ;
7
7
8
- this . dashboardUrl = "http://localhost:8080/api/posting/company/" + this . props . cookies . get ( "id" ) ;
8
+ this . dashboardUrl = "http://localhost:8080/api/posting/company/" + this . props . cookies . get ( "id" )
9
9
10
10
this . state = {
11
11
companyPostingsData : [ ] ,
Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ class Signin extends Component {
63
63
. then ( data => {
64
64
const cookie = data [ 0 ] ;
65
65
66
- if ( cookie != null ) {
67
- const cookies = this . props . cookies ;
66
+ if ( ! ( cookie == null ) ) {
67
+ const cookiesProp = this . props . cookies ;
68
68
69
- cookies . set ( "username" , username , { path : '/' } ) ;
70
- cookies . set ( "id" , cookies . id , { path : '/' } ) ;
71
- cookies . set ( "isUser" , cookies . isUser , { path : '/' } ) ;
72
- cookies . set ( "authenticationHash" , cookie . cookie , { path : '/' } ) ;
69
+ cookiesProp . set ( "username" , username , { path : '/' } ) ;
70
+ cookiesProp . set ( "id" , cookie . id , { path : '/' } ) ;
71
+ cookiesProp . set ( "isUser" , cookie . isUser , { path : '/' } ) ;
72
+ cookiesProp . set ( "authenticationHash" , cookie . cookie , { path : '/' } ) ;
73
73
74
- if ( cookies . isUser ) {
74
+ if ( cookie . isUser ) {
75
75
this . handleRedirect ( "/postings" )
76
76
}
77
77
else {
Original file line number Diff line number Diff line change @@ -94,21 +94,24 @@ class Signup extends Component {
94
94
website,
95
95
description
96
96
} ;
97
+ console . log ( userPayload )
97
98
}
98
99
99
100
fetch ( userUrl , {
100
101
method : "POST" ,
101
102
body : JSON . stringify ( userPayload )
102
103
} ) //FIXME add check for is user exists
103
104
. then ( response => response . json ( ) )
104
- . then ( data => this . createUserAuthentication ( data [ 0 ] . userId ) )
105
+ . then ( data => {
106
+ this . createUserAuthentication ( ( isUser ) ? data [ 0 ] . userId : data [ 0 ] . companyId )
107
+ } )
105
108
. catch ( err => {
106
109
} )
107
110
108
111
return ;
109
112
}
110
113
111
- createUserAuthentication ( userId ) {
114
+ createUserAuthentication ( id ) {
112
115
const {
113
116
isUser,
114
117
username,
@@ -118,12 +121,14 @@ class Signup extends Component {
118
121
const authenticationUrl = "http://localhost:8080/api/authentication" ;
119
122
120
123
let authenticationPayload = {
121
- id : userId ,
124
+ id : id ,
122
125
username : username ,
123
126
passwordHash : password ,
124
127
isUser : isUser
125
128
} ;
126
129
130
+ console . log ( authenticationPayload ) ;
131
+
127
132
fetch ( authenticationUrl , {
128
133
method : "POST" ,
129
134
body : JSON . stringify ( authenticationPayload )
@@ -234,7 +239,7 @@ class Signup extends Component {
234
239
</ Form . Group >
235
240
236
241
< Form . Group controlId = "formGridWebsite" >
237
- < Form . Label > Email </ Form . Label >
242
+ < Form . Label > Website </ Form . Label >
238
243
< Form . Control
239
244
required
240
245
type = "website"
You can’t perform that action at this time.
0 commit comments