Skip to content

Commit

Permalink
use webapp openLink
Browse files Browse the repository at this point in the history
  • Loading branch information
duanyytop committed Nov 24, 2023
1 parent e11cacc commit 80dcf8f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {WebApp} from "@vkruglikov/react-telegram-web-app/lib/core/twa-types";
import "./App.css";
import { buildConnectTokenAndUrl, buildSendTxTokenAndUrl, buildSignMsgTokenAndUrl } from "./helper";
import {api, ConnectResp, QueryKey, SendResp, SignResp} from "./api";
import { IS_IPHONE } from "./env/browser";

const USER_REJECTED = 'rejected'

Expand All @@ -26,10 +25,6 @@ export default function App() {
const [sendToken, setSendToken] = useState("");

const openUrl = (url: string) => {
if (IS_IPHONE) {
window.open(url, "_blank");
return
}
webApp.openLink && webApp.openLink(url);
}

Expand Down Expand Up @@ -119,7 +114,7 @@ export default function App() {
const {token, url} = buildConnectTokenAndUrl(webApp.initData);
setConnectToken(token);
setConnectLoading(true);
openUrl(url)
openUrl(url);
} catch (error) {
console.log(error);
}
Expand Down Expand Up @@ -219,7 +214,7 @@ export default function App() {
</div>
) : (
<div className="text-center">
<button className="btn btn-primary capitalize w-[200px] mt-[30px]" onClick={onConnect}>
<button className="btn btn-primary capitalize w-[200px] mt-[30px]" onClick={() => onConnect()}>
{connectLoading ? <span className="loading loading-spinner loading-md" /> : "JoyID Passkey connect"}
</button>
</div>
Expand Down

0 comments on commit 80dcf8f

Please sign in to comment.