From fd26a7aa29e61b349385b981810d748cb61e87af Mon Sep 17 00:00:00 2001 From: VictoryJu Date: Fri, 30 Aug 2024 02:58:25 +0900 Subject: [PATCH] [fix]: handleIosWebviewToken function global --- src/App.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 89c1070..6644413 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,8 +2,9 @@ import { useEffect, useState } from 'react'; import { RootRouter } from './router/RootRouter'; import { setUserAuth } from './stores/useAuthStore'; import { showiOSInfo, webviewInit } from './webview/utils'; -function App() { - const handleIosWebviewToken = (token: string, uuid: string) => { + +if (!window.handleIosWebviewToken) { + window.handleIosWebviewToken = (token, uuid) => { showiOSInfo(`token:${token},uuid:${uuid}`); if (token) { setUserAuth(token, uuid); @@ -11,9 +12,10 @@ function App() { } return 'fail'; }; +} +function App() { useEffect(() => { - window.handleIosWebviewToken = handleIosWebviewToken; webviewInit(); }, []);