Skip to content

Commit

Permalink
chore: test tg request write access
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 4, 2023
1 parent 07a0ec8 commit 8decf8d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useState} from "react";
import {useEffect, useState} from "react";
import {Address, Hex, parseEther} from "viem";
import {useQuery} from "react-query";
import {useWebApp} from "@vkruglikov/react-telegram-web-app"
Expand Down Expand Up @@ -75,7 +75,7 @@ export default function App() {
setSignLoading(false);
if (sig === USER_REJECTED) {
showAlert("User refuses to sign");
} else {
} else {
showAlert(`Signing successful with result: ${sig}`);
}
},
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function App() {
const onConnect = () => {
if (webApp.initData.length === 0) {
alert('Please open the web app in Telegram')
return
return
}
try {
const {token, url} = buildConnectTokenAndUrl(webApp.initData);
Expand Down Expand Up @@ -186,7 +186,7 @@ export default function App() {
openUrl(url);
} catch (error) {
console.log(error);
}
}
};


Expand All @@ -210,6 +210,12 @@ export default function App() {
}
};

useEffect(() => {
console.log(webApp.version)
const win: any = window;

Check failure on line 215 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type

Check failure on line 215 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
win.Telegram.WebApp.requestWriteAccess();
}, []);

Check warning on line 217 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has a missing dependency: 'webApp.version'. Either include it or remove the dependency array

Check warning on line 217 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has a missing dependency: 'webApp.version'. Either include it or remove the dependency array

return (
<div id="app">
<div className="text-2xl sticky font-bold text-center">Mini App wallet connect demo</div>
Expand Down

0 comments on commit 8decf8d

Please sign in to comment.