-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DEV-24810] uses URL api instead of string interpolation #66
base: master
Are you sure you want to change the base?
Conversation
Previously URLs that already had parameters would have two question marks "?"
src/helpers/sharing_helper.ts
Outdated
@@ -9,6 +9,14 @@ export const toQuery = (object: Record<string, any>) => { | |||
return searchParams ? `?${searchParams}` : '' | |||
} | |||
|
|||
export const addParamsToUrl = (oldUrl: string, params: Record<string, any>) => { | |||
const newUrl = new URL(oldUrl) | |||
for (const [key, value] of params.entries()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is actually Record<string, any>
then hashes do not posses methods, you should use Object.entries(params)
, if this is actually URLSearchParams
then please type the argument as such
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm following what comes from this:
export type BaseShareActionArgs = { shareUrl: string; utmParams?: Record<string, any>; teaser?: string }
I changed the entries call.
DEV-24810
uses URL api instead of string interpolation
Previously URLs that already had parameters
would have two question marks "?"
I'll publish after merging and add it to the main project.