File tree Expand file tree Collapse file tree
frontend/src/components/userEvents Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,26 +204,24 @@ export function UserEventModal({
204204 const failed = [ ] ;
205205 Promise . allSettled (
206206 formik . values . analyzables . map ( ( analyzable ) => {
207- if ( inputState [ analyzable ] . type === UserEventTypes . IP_WILDCARD )
207+ const state = inputState [ analyzable ] ?? {
208+ type : UserEventTypes . ANALYZABLE ,
209+ eventId : null ,
210+ } ;
211+ if ( state . type === UserEventTypes . IP_WILDCARD )
208212 evaluation . network = analyzable ;
209- else if (
210- inputState [ analyzable ] . type === UserEventTypes . DOMAIN_WILDCARD
211- )
213+ else if ( state . type === UserEventTypes . DOMAIN_WILDCARD )
212214 evaluation . query = analyzable ;
213215 else evaluation . analyzable = { name : analyzable } ;
214216
215- if ( inputState [ analyzable ] ?. eventId ) {
216- // edit an existing evaluation
217+ if ( state . eventId ) {
217218 return axios . patch (
218- `${ userEventTypesToApiMapping [ inputState [ analyzable ] . type ] } /${
219- inputState [ analyzable ] . eventId
220- } `,
219+ `${ userEventTypesToApiMapping [ state . type ] } /${ state . eventId } ` ,
221220 evaluation ,
222221 ) ;
223222 }
224- // create a new evaluation
225223 return axios . post (
226- `${ userEventTypesToApiMapping [ inputState [ analyzable ] . type ] } ` ,
224+ `${ userEventTypesToApiMapping [ state . type ] } ` ,
227225 evaluation ,
228226 ) ;
229227 } ) ,
You can’t perform that action at this time.
0 commit comments