@@ -31,7 +31,7 @@ class Contractors extends Component {
3131
3232 subject_change ( selected_subject ) {
3333 if ( selected_subject ) {
34- this . props . history . push ( this . props . root . url ( `subject/${ slugify ( selected_subject . name ) } ` ) )
34+ this . props . history . push ( this . props . root . url ( `subject/${ selected_subject . id } - ${ slugify ( selected_subject . name ) } ` ) )
3535 } else {
3636 this . props . history . push ( this . props . root . url ( '' ) )
3737 }
@@ -40,10 +40,10 @@ class Contractors extends Component {
4040
4141 async update_contractors ( selected_subject ) {
4242 if ( ! selected_subject ) {
43- const m = this . props . history . location . pathname . match ( / s u b j e c t \/ ( [ ^ / ] + ) / )
44- const subject_slug = m ? m [ 1 ] : null
45- if ( subject_slug && this . state . subjects . length > 0 ) {
46- selected_subject = this . state . subjects . find ( s => slugify ( s . name ) === subject_slug )
43+ const m = this . props . history . location . pathname . match ( / s u b j e c t \/ ( \d + ) / )
44+ const subject_id = m ? parseInt ( m [ 1 ] , 10 ) : null
45+ if ( subject_id && this . state . subjects . length > 0 ) {
46+ selected_subject = this . state . subjects . find ( s => s . id === subject_id )
4747 }
4848 }
4949
@@ -84,8 +84,8 @@ class Contractors extends Component {
8484 subject_change = { this . subject_change }
8585 root = { this . props . root } />
8686
87- < Route path = { this . props . root . url ( ':con([0-9]+-.+) ' ) } render = { props => (
88- < ConModal con_link = { props . match . params . con }
87+ < Route path = { this . props . root . url ( ':id(\\d+):_extra ' ) } render = { props => (
88+ < ConModal id = { props . match . params . id }
8989 contractors = { this . state . contractors }
9090 got_contractors = { this . state . got_contractors }
9191 get_contractor_details = { this . get_contractor_details }
0 commit comments