Skip to content

Commit b8827ba

Browse files
authored
Set SA to false when ND is selected (#236)
1 parent 1eac9c2 commit b8827ba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/store/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,21 @@ const createStore = (state) => {
4141
}
4242
},
4343
mutations: {
44+
/**
45+
* Updates current license attributes when user selects radio option.
46+
* Edge case: If user selects ND, SA should be set to false
47+
* @param state
48+
* @param {string} stepName
49+
* @param {Boolean} isSelected
50+
*/
4451
setSelected(state, { stepName, isSelected }) {
45-
// When a Radio button is selected, currentLicenseAttribute 'selected' attribute is updated
46-
if (['BY', 'NC', 'ND', 'SA'].indexOf(stepName) > -1) {
52+
if (stepName === 'ND' && isSelected && state.currentLicenseAttributes.SA) {
53+
state.currentLicenseAttributes = {
54+
...state.currentLicenseAttributes,
55+
SA: false,
56+
ND: true
57+
}
58+
} else if (['BY', 'NC', 'ND', 'SA'].indexOf(stepName) > -1) {
4759
state.currentLicenseAttributes = {
4860
...state.currentLicenseAttributes,
4961
[stepName]: isSelected

0 commit comments

Comments
 (0)