File tree Expand file tree Collapse file tree
src/hooks/useNaverMapInit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { useIsomorphicLayoutEffect } from "../useIsomorphicLayoutEffect";
44import { SCRIPT_ID } from "./constants" ;
55import type { InitResult , UseNaverMapInit } from "./types" ;
66import {
7- createNaverMapScriptByClientId ,
7+ createNaverMapScriptByKeyId ,
88 insertNaverMapScriptIntoHead ,
99} from "./utils" ;
1010
@@ -17,7 +17,7 @@ import {
1717 * @param onError - This function will triggered when loading script failed. If 'onError' changes too often, wrap that definition in useCallback
1818 */
1919export const useNaverMapInit : UseNaverMapInit = ( {
20- ncpClientId ,
20+ ncpKeyId ,
2121 submodules,
2222 onLoad,
2323 onError,
@@ -39,8 +39,8 @@ export const useNaverMapInit: UseNaverMapInit = ({
3939
4040 const initNaverMapScript = async ( ) => {
4141 const scriptInitResult = new Promise < InitResult > ( ( resolve , reject ) => {
42- const script = createNaverMapScriptByClientId ( {
43- ncpClientId ,
42+ const script = createNaverMapScriptByKeyId ( {
43+ ncpKeyId : ncpKeyId ,
4444 submodules,
4545 } ) ;
4646 insertNaverMapScriptIntoHead ( script ) ;
@@ -62,7 +62,7 @@ export const useNaverMapInit: UseNaverMapInit = ({
6262 } ;
6363
6464 initNaverMapScript ( ) ;
65- } , [ ncpClientId ] ) ;
65+ } , [ ncpKeyId ] ) ;
6666
6767 useIsomorphicLayoutEffect ( ( ) => {
6868 if ( onLoad && isFunction ( onLoad ) && isLoaded ) {
Original file line number Diff line number Diff line change 11export interface InitParams {
2- ncpClientId : string ;
2+ ncpKeyId : string ;
33 submodules ?: Submodule [ ]
44 onLoad ?: VoidFunction ;
55 onError ?: VoidFunction ;
Original file line number Diff line number Diff line change 11import { SCRIPT_ID } from "../constants" ;
22import type { InitParams } from "../types" ;
33
4- export const createNaverMapScriptByClientId = ( {
5- ncpClientId ,
4+ export const createNaverMapScriptByKeyId = ( {
5+ ncpKeyId ,
66 submodules,
7- } : Pick < InitParams , "ncpClientId " | "submodules" > ) => {
7+ } : Pick < InitParams , "ncpKeyId " | "submodules" > ) => {
88 const script = document . createElement ( "script" ) ;
9- let paramsString = `ncpClientId =${ ncpClientId } ` ;
9+ let paramsString = `ncpKeyId =${ ncpKeyId } ` ;
1010
1111 if ( submodules ?. length ) {
1212 paramsString = paramsString . concat ( `&submodules=${ submodules . join ( "," ) } ` ) ;
Original file line number Diff line number Diff line change 1- export * from "./createNaverMapScriptByClientId " ;
1+ export * from "./createNaverMapScriptByKeyId " ;
22export * from "./insertNaverMapScriptIntoHead" ;
You can’t perform that action at this time.
0 commit comments