File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
packages/react-google-maps-api/src Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export type UseLoadScriptOptions = LoadScriptUrlOptions & {
1616 id ?: string | undefined
1717 nonce ?: string | undefined
1818 preventGoogleFontsLoading ?: boolean | undefined
19+ apiUrl ?: string
1920}
2021
2122let previouslyLoadedUrl : string
@@ -33,6 +34,7 @@ export function useLoadScript({
3334 channel,
3435 mapIds,
3536 authReferrerPolicy,
37+ apiUrl = "https://maps.googleapis.com" ,
3638} : UseLoadScriptOptions ) : {
3739 isLoaded : boolean
3840 loadError : Error | undefined
@@ -80,6 +82,7 @@ export function useLoadScript({
8082 channel,
8183 mapIds,
8284 authReferrerPolicy,
85+ apiUrl,
8386 } )
8487
8588 useEffect (
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export type LoadScriptUrlOptions = {
1313 channel ?: string | undefined
1414 mapIds ?: string [ ] | undefined
1515 authReferrerPolicy ?: 'origin' | undefined
16+ apiUrl ?: string
1617}
1718
1819export function makeLoadScriptUrl ( {
@@ -25,6 +26,7 @@ export function makeLoadScriptUrl({
2526 channel,
2627 mapIds,
2728 authReferrerPolicy,
29+ apiUrl = 'https://maps.googleapis.com' ,
2830} : LoadScriptUrlOptions ) : string {
2931 const params = [ ]
3032
@@ -71,5 +73,5 @@ export function makeLoadScriptUrl({
7173 params . push ( 'loading=async' )
7274 params . push ( 'callback=initMap' )
7375
74- return `https://maps.googleapis.com /maps/api/js?${ params . join ( '&' ) } `
76+ return `${ apiUrl } /maps/api/js?${ params . join ( '&' ) } `
7577}
You can’t perform that action at this time.
0 commit comments