mirror of
https://github.com/FlipsideCrypto/flipside-js.git
synced 2026-02-06 10:48:11 +00:00
Use URLSearchParams function.
This commit is contained in:
parent
cde8ae754c
commit
56cd6f206a
@ -14,19 +14,6 @@ type Props = {
|
||||
|
||||
type State = {};
|
||||
|
||||
const encodeURLParams = (url: string, data: any): string => {
|
||||
let params = "";
|
||||
for (const key in data) {
|
||||
if (params !== "") {
|
||||
params += "&";
|
||||
}
|
||||
if (data[key] !== undefined && data[key] !== null) {
|
||||
params += key + "=" + encodeURIComponent(data[key]);
|
||||
}
|
||||
}
|
||||
return `${url}?${params}`;
|
||||
};
|
||||
|
||||
export default class Frame extends Component<Props, State> {
|
||||
static defaultProps = {
|
||||
width: "100%",
|
||||
@ -111,7 +98,8 @@ export default class Frame extends Component<Props, State> {
|
||||
) {
|
||||
urlParams = { ...props.data, ...urlParams };
|
||||
}
|
||||
url = encodeURLParams(props.url, urlParams);
|
||||
const urlEncodedParams = new URLSearchParams(urlParams).toString();
|
||||
url = `${url}?${urlEncodedParams}`;
|
||||
|
||||
return (
|
||||
<iframe
|
||||
|
||||
Loading…
Reference in New Issue
Block a user