We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ddc1440 commit 91e99f3Copy full SHA for 91e99f3
src/components/common-action-modal/index.js
@@ -11,11 +11,11 @@ const fetchData = async ( apiUrl, getParams = null ) => {
11
random: 1,
12
language,
13
};
14
- let paramString = '';
15
- Object.keys( params ).forEach( ( key ) => paramString += `${ key }=${ params[ key ] }&` );
+
+ const paramString = new URLSearchParams( params ).toString();
16
17
try {
18
- const response = await fetch( `${ apiUrl }?${ paramString.slice( 0, -1 ) }` );
+ const response = await fetch( `${ apiUrl }?${ paramString }` );
19
if ( ! response.ok ) {
20
return null;
21
}
0 commit comments