Fix AX validity checking for good hopefully
This commit is contained in:
parent
3a81675737
commit
0a993f856b
1 changed files with 23 additions and 8 deletions
|
|
@ -91,39 +91,54 @@ const AXSelect = (props: Props) => {
|
||||||
props.currentSkills &&
|
props.currentSkills &&
|
||||||
props.currentSkills[0].modifier != null &&
|
props.currentSkills[0].modifier != null &&
|
||||||
props.currentSkills[0].modifier >= 0
|
props.currentSkills[0].modifier >= 0
|
||||||
)
|
) {
|
||||||
setPrimaryAxModifier(props.currentSkills[0].modifier)
|
setPrimaryAxModifier(props.currentSkills[0].modifier)
|
||||||
else setPrimaryAxModifier(-1)
|
setPrimaryAxValue(props.currentSkills[0].strength)
|
||||||
|
} else setPrimaryAxModifier(-1)
|
||||||
}, [props.currentSkills, setPrimaryAxModifier])
|
}, [props.currentSkills, setPrimaryAxModifier])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.currentSkills && props.currentSkills[1].modifier) {
|
if (props.currentSkills && props.currentSkills[1].modifier) {
|
||||||
setSecondaryAxModifier(props.currentSkills[1].modifier)
|
setSecondaryAxModifier(props.currentSkills[1].modifier)
|
||||||
|
setSecondaryAxValue(props.currentSkills[1].strength)
|
||||||
} else {
|
} else {
|
||||||
setSecondaryAxModifier(-1)
|
setSecondaryAxModifier(-1)
|
||||||
}
|
}
|
||||||
}, [props.currentSkills, setSecondaryAxModifier])
|
}, [props.currentSkills, setSecondaryAxModifier])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(
|
||||||
|
primaryAxModifier,
|
||||||
|
primaryAxValue,
|
||||||
|
secondaryAxModifier,
|
||||||
|
secondaryAxValue
|
||||||
|
)
|
||||||
|
|
||||||
let noErrors = false
|
let noErrors = false
|
||||||
|
|
||||||
if (errors.axValue1 === '' && errors.axValue2 === '') {
|
if (errors.axValue1 === '' && errors.axValue2 === '') {
|
||||||
if (primaryAxModifier === -1 && secondaryAxModifier === -1) {
|
if (primaryAxModifier === -1 && secondaryAxModifier === -1)
|
||||||
noErrors = true
|
noErrors = true
|
||||||
} else if (
|
else if (
|
||||||
primaryAxModifier >= 0 &&
|
primaryAxModifier >= 0 &&
|
||||||
primaryAxValue > 0 &&
|
primaryAxValue > 0 &&
|
||||||
secondaryAxModifier === -1
|
secondaryAxModifier === -1
|
||||||
) {
|
)
|
||||||
noErrors = true
|
noErrors = true
|
||||||
} else if (
|
else if (
|
||||||
primaryAxModifier >= 0 &&
|
primaryAxModifier >= 0 &&
|
||||||
primaryAxValue > 0 &&
|
primaryAxValue > 0 &&
|
||||||
secondaryAxModifier >= 0 &&
|
secondaryAxModifier >= 0 &&
|
||||||
secondaryAxValue > 0
|
secondaryAxValue > 0
|
||||||
) {
|
)
|
||||||
noErrors = true
|
noErrors = true
|
||||||
}
|
else
|
||||||
|
console.log(
|
||||||
|
primaryAxModifier >= 0,
|
||||||
|
primaryAxValue > 0,
|
||||||
|
secondaryAxModifier >= 0,
|
||||||
|
secondaryAxValue > 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
props.sendValidity(noErrors)
|
props.sendValidity(noErrors)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue