Skip to content

Commit

Permalink
fix(useInitData): fix data usage from outside TWA
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzwan committed Nov 13, 2023
1 parent 7ab512b commit 32952db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altiore/twa",
"version": "1.2.4",
"version": "1.2.5",
"description": "React components for Telegram WebApp",
"source": "./src/index.ts",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/useInitData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export type InitDataUnsafe = {
* ```
* @group Hooks
*/
const useInitData = (): { initUnsafe: InitDataUnsafe; init: InitData } => {
const useInitData = (): { initUnsafe?: InitDataUnsafe; init?: InitData } => {
const WebApp = useWebApp();

return { initUnsafe: WebApp!.initDataUnsafe, init: WebApp!.initData };
return { initUnsafe: WebApp?.initDataUnsafe, init: WebApp?.initData };
};

export default useInitData;

0 comments on commit 32952db

Please sign in to comment.