export const queryEncode = ( params ) => { const param_list = [ ] ; for ( const key in params ) { let param = params [ key ] ; if ( param === null ) continue ; if ( Array . isArray ( param ) ) param = param . join ( ',' ) ; else if ( typeof param == 'object' ) param = JSON . stringify ( param ) ; param_list . push ( `${ key }=${ param }` ) ; } return param_list . join ( '&' ) ; } ; export const createPayload = ( params ) => { const payload = { ... params } ; for ( const key in payload ) { const param = payload [ key ] ; if ( param == null ) delete payload [ key ] ; else if ( typeof param !== 'string' ) payload [ key ] = JSON . stringify ( param ) ; } return payload ; } ;