File tree Expand file tree Collapse file tree
src/editors/containers/ProblemEditor
components/EditProblemView/AnswerWidget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ const AnswerOption = ({
7373
7474 if ( problemType !== ProblemTypeKeys . NUMERIC || ! answer . isAnswerRange ) {
7575 return (
76- < Form . Group isInvalid = { ! data ?. isValid ?? true } >
76+ < Form . Group isInvalid = { ! data ?. isValid } >
7777 < Form . Control
7878 as = "textarea"
7979 className = "answer-option-textarea text-gray-500 small"
@@ -89,7 +89,7 @@ const AnswerOption = ({
8989 placeholder = { intl . formatMessage ( messages . answerTextboxPlaceholder ) }
9090
9191 />
92- { ( ! data ?. isValid ?? true ) && (
92+ { ( ! data ?. isValid ) && (
9393 < Form . Control . Feedback type = "invalid" >
9494 < FormattedMessage { ...messages . answerNumericErrorText } />
9595 </ Form . Control . Feedback >
Original file line number Diff line number Diff line change @@ -4,8 +4,14 @@ import api from '@src/editors/data/services/cms/api';
44
55const getApiBaseUrl = ( ) => getConfig ( ) . STUDIO_BASE_URL ;
66
7+ interface ValidationResult {
8+ isValid : boolean ;
9+ error ?: string ;
10+ preview ?: string ;
11+ }
12+
713export const useValidateInputBlock = ( ) => useMutation ( {
8- mutationFn : async ( title : string ) => {
14+ mutationFn : async ( title : string ) : Promise < ValidationResult > => {
915 try {
1016 const res = await api . validateBlockNumericInput ( { studioEndpointUrl : `${ getApiBaseUrl ( ) } ` , data : { formula : title } } ) ;
1117 return camelCaseObject ( res . data ) ;
You can’t perform that action at this time.
0 commit comments