diff --git a/src/components/FareAttributesDetail.js b/src/components/FareAttributesDetail.js
index 1dc0dc2..ed2e7c0 100644
--- a/src/components/FareAttributesDetail.js
+++ b/src/components/FareAttributesDetail.js
@@ -118,7 +118,7 @@ class FareAttributesDetail extends Component {
New fare rule
- {farerule.results.map(ele => )}
+ {farerule.results && farerule.results.map(ele => )}
)
}
diff --git a/src/components/FareRulesDetail.js b/src/components/FareRulesDetail.js
index fe1e085..b7a6197 100644
--- a/src/components/FareRulesDetail.js
+++ b/src/components/FareRulesDetail.js
@@ -3,10 +3,10 @@ import styled from 'styled-components'
import { Link } from 'react-router-dom'
const FakeRow = styled.nav`
-padding-top: 5px;
-padding-bottom: 5px;
+padding-top: 3px;
+padding-bottom: 3px;
background: white;
-margin-bottom: 1rem;
+margin-bottom: 5px !important;
`
export const FareRulesOne = (props) => {
diff --git a/src/components/FareRulesForm.js b/src/components/FareRulesForm.js
index 0e2aa5a..d74b0d3 100644
--- a/src/components/FareRulesForm.js
+++ b/src/components/FareRulesForm.js
@@ -186,7 +186,7 @@ class FareRulesForm extends Component {
result = {
target: {
name: fieldName,
- value: resp.map(el => el.value.stop_id),
+ value: resp.map(el => el.value.stop_id).join(','),
}
}
} else if (evt.action === 'clear') {
@@ -215,7 +215,7 @@ class FareRulesForm extends Component {
result = {
target: {
name: fieldName,
- value: resp.map(el => el.value.stop_id),
+ value: resp.map(el => el.value.stop_id).join(','),
}
}
} else if (evt.action === 'clear') {
@@ -244,7 +244,8 @@ class FareRulesForm extends Component {
DELETE
}
- Cancel
+ Cancel
@@ -259,7 +260,7 @@ class FareRulesForm extends Component {
// this is a create form
if (ruleID === undefined) {
if (one.justSubmit === true && !fetching) {
- return
+ return
}
return this.renderForm()
}
@@ -269,7 +270,7 @@ class FareRulesForm extends Component {
// redirect to fare list if submitted
if (one.justSubmit === true && !fetching) {
- return
+ return
}
return this.renderForm()
}
diff --git a/src/reducers/farerule.js b/src/reducers/farerule.js
index f991e6c..039b391 100644
--- a/src/reducers/farerule.js
+++ b/src/reducers/farerule.js
@@ -14,14 +14,17 @@ const fareRuleInitState = {
const fareRule = (state = fareRuleInitState, action) => {
switch(action.type) {
case FARERULE_REQUEST:
- let resetResult = state.query !== action.meta.query ? [] : state.results
- let resetCount = state.query !== action.meta.query ? 0 : state.count
+ let resetResult, resetCount
+ if (action.meta !== undefined) {
+ resetResult = state.query !== action.meta.query ? [] : state.results
+ resetCount = state.query !== action.meta.query ? 0 : state.count
+ }
return {
...state,
fetching: true,
query: action.meta !== undefined ? action.meta.query : state.query,
- results: resetResult,
- count: resetCount,
+ results: action.meta !== undefined ? resetResult : state.results,
+ count: action.meta !== undefined ? resetCount : state.count,
}
case FARERULE_SUCCESS:
const { count, next, prev, results } = action.payload