Skip to content

Commit 128e77d

Browse files
fix(calltaker): Add config to show call hist on load; clear itins on call end.
Co-authored with @robertgregg3.
1 parent 24cf3d0 commit 128e77d

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ if (process.env.NODE_ENV === 'development') {
124124
// set up the Redux store
125125
const store = createStore(
126126
combineReducers({
127-
callTaker: createCallTakerReducer(),
127+
callTaker: createCallTakerReducer(otpConfig),
128128
otp: createOtpReducer(otpConfig),
129129
user: createUserReducer(),
130130
router: connectRouter(history)

lib/actions/call-taker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export function endCall () {
6666
console.error(err)
6767
alert(`Could not save call: ${JSON.stringify(err)}`)
6868
})
69+
// Clear itineraries shown when ending call.
70+
dispatch(resetForm(true))
6971
dispatch(endingCall())
7072
}
7173
}

lib/reducers/call-taker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ import moment from 'moment'
44
import {constructNewCall} from '../util/call-taker'
55
import {FETCH_STATUS} from '../util/constants'
66

7-
function createCallTakerReducer () {
7+
function createCallTakerReducer (config) {
8+
const calltakerConfig = config.modules.find(m => m.id === 'call')
89
const initialState = {
910
activeCall: null,
1011
callHistory: {
1112
calls: {
1213
status: FETCH_STATUS.UNFETCHED,
1314
data: []
1415
},
15-
visible: false
16+
visible: calltakerConfig &&
17+
calltakerConfig.options &&
18+
calltakerConfig.options.showCallHistoryOnLoad
1619
},
1720
fieldTrip: {
1821
activeId: null,

0 commit comments

Comments
 (0)