Skip to content

Commit

Permalink
[fix]: handleIosWebviewToken function global
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoryJu committed Aug 29, 2024
1 parent 71efb0a commit fd26a7a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ 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);
return 'success';
}
return 'fail';
};
}

function App() {
useEffect(() => {
window.handleIosWebviewToken = handleIosWebviewToken;
webviewInit();
}, []);

Expand Down

0 comments on commit fd26a7a

Please sign in to comment.