@@ -23,6 +23,7 @@ import axios from 'axios';
2323import { routePaths } from '../../../../../routes/routePaths' ;
2424import { SidePopup } from '../SidePopup' ;
2525import { callActionForStackComponentsForPagination } from '../../Stacks/useService' ;
26+ // import { keys } from 'lodash';
2627
2728export const CreateComponent : React . FC < { flavor : any } > = ( { flavor } ) => {
2829 const {
@@ -86,7 +87,7 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
8687
8788 const handleRemoveFields = ( parentIndex : any , childIndex : any , name : any ) => {
8889 const values = [ ...inputFields ] ;
89- debugger ;
90+ // debugger;
9091 values [ parentIndex ] [ name ] . splice ( childIndex , 1 ) ;
9192 setInputFields ( values ) ;
9293 } ;
@@ -322,15 +323,15 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
322323 const { id } : any = workspaces . find (
323324 ( item ) => item . name === selectedWorkspace ,
324325 ) ;
325-
326+ // debugger;
326327 const final : any = { } ;
327328 inputFields . forEach ( ( ar : any ) => {
328329 const keys = Object . keys ( ar ) ;
329330 keys . forEach ( ( key ) => {
330331 final [ key ] = { } ;
331332
332333 ar [ key ] . forEach ( ( nestedArr : any ) => {
333- if ( nestedArr . key && nestedArr . value ) {
334+ if ( nestedArr . key || nestedArr . value ) {
334335 final [ key ] = {
335336 ...final [ key ] ,
336337 [ nestedArr . key ] : nestedArr . value ,
@@ -343,7 +344,27 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
343344 } ) ;
344345 } ) ;
345346 } ) ;
346-
347+ for ( const [ key ] of Object . entries ( final ) ) {
348+ // console.log(`${key}: ${value}`);
349+ for ( const [ innerKey , innerValue ] of Object . entries ( final [ key ] ) ) {
350+ if ( ! innerKey && innerValue ) {
351+ return dispatch (
352+ showToasterAction ( {
353+ description : 'Key cannot be Empty.' ,
354+ type : toasterTypes . failure ,
355+ } ) ,
356+ ) ;
357+ }
358+ if ( ! innerValue && innerKey ) {
359+ return dispatch (
360+ showToasterAction ( {
361+ description : 'Value cannot be Empty.' ,
362+ type : toasterTypes . failure ,
363+ } ) ,
364+ ) ;
365+ }
366+ }
367+ }
347368 const body = {
348369 user : user ?. id ,
349370 workspace : id ,
0 commit comments