File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
apps/web/src/pages/MemeDetailPage/components Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -24,20 +24,17 @@ const MemeShareSheet = ({
2424
2525 useEffect ( ( ) => {
2626 // Kakao SDK 초기화
27- if ( ! window . Kakao ) {
28- const script = document . createElement ( 'script' ) ;
29- script . src = 'https://developers.kakao.com/sdk/js/kakao.js' ;
30- script . async = true ;
31- document . head . appendChild ( script ) ;
32-
33- script . onload = ( ) => {
34- window . Kakao . init ( '05ba74b5a769929cd086247c874b60e4' ) ;
35- } ;
27+ if ( window . Kakao && ! window . Kakao . isInitialized ( ) ) {
28+ window . Kakao . init ( '05ba74b5a769929cd086247c874b60e4' ) ;
3629 }
3730 } , [ ] ) ;
3831
3932 const handleKakaoShare = ( ) => {
40- if ( window . Kakao ) {
33+ if ( ! window . Kakao ?. isInitialized ( ) ) {
34+ window . Kakao ?. init ( '05ba74b5a769929cd086247c874b60e4' ) ;
35+ }
36+
37+ if ( window . Kakao ?. Share ) {
4138 window . Kakao . Share . sendDefault ( {
4239 objectType : 'feed' ,
4340 content : {
@@ -159,6 +156,7 @@ interface KakaoShare {
159156
160157interface KakaoSDK {
161158 init : ( key : string ) => void ;
159+ isInitialized : ( ) => boolean ;
162160 Share : KakaoShare ;
163161}
164162
You can’t perform that action at this time.
0 commit comments