Skip to content

Commit

Permalink
Fix a bug that contained undefined string in date (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmu332233 committed Dec 4, 2022
1 parent ba842f5 commit aa2ba86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type QueryParameters = { [key: string]: any };
export const objectToQueryString = (queryParameters: QueryParameters) => {
return queryParameters
? Object.entries(queryParameters).reduce((queryString, [key, value]) => {
const encodedValue = encodeURIComponent(value);
const encodedValue = value && encodeURIComponent(value);
const symbol = queryString.length === 0 ? '?' : '&';
queryString += encodedValue ? `${symbol}${key}=${encodedValue}` : '';
return queryString;
Expand Down

1 comment on commit aa2ba86

@vercel
Copy link

@vercel vercel bot commented on aa2ba86 Dec 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.