Skip to content

Commit

Permalink
feat: Stringify config data if it's an object
Browse files Browse the repository at this point in the history
  • Loading branch information
pitahorn committed May 3, 2024
1 parent efe370a commit 733dedc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { EVENT_MAP } from './constants';

const defaultHanlder = () => null;

export const buildQueryString = (config: Record<string, string>): string => Object.keys(config).map((key) => `${key}=${config[key]}`).join('&');
export const buildQueryString = (
config: Record<string, string | Record<string, string>>,
): string => Object.keys(config).map((key) => {
if (typeof config[key] === 'string') {
return `${key}=${config[key]}`

Check failure on line 11 in src/lib/utils.ts

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
}
return `${key}=${JSON.stringify(config[key])}`

Check failure on line 13 in src/lib/utils.ts

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
}).join('&');

export const buildMessageHandler = (handlers: FintocWidgetEventHandlers) => (
(event: WebViewMessageEvent) => {
Expand Down

0 comments on commit 733dedc

Please sign in to comment.