Skip to content

Commit

Permalink
Experimental: initialize line
Browse files Browse the repository at this point in the history
  • Loading branch information
thi-investax committed Jan 6, 2025
1 parent 4a8d756 commit 60588f3
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,38 @@ export default function App() {
return (config?.pages ?? []).length > 0 ? config?.pages[0] : defaultPath
}, [kyc, account, chainId, isWhitelisted, chains])

// useEffect(() => {
// const initLiff = async () => {
// liff
// .init({ liffId: '2006746651-DmRwZed0' })
// .then(() => {
// console.log('LIFF initialization is done')
// console.log(liff.getAppLanguage())
// console.log(liff.getVersion())
// console.log(liff.isInClient())
// console.log(liff.isLoggedIn())
// console.log(liff.getOS())
// console.log(liff.getLineVersion())

// setIsLiffReady(true) // Ensure LIFF initialization is complete
// })
// .catch((error: any) => {
// console.error(`LIFF initialization failed: ${error}`)
// })
// }
useEffect(() => {
const initLiff = async () => {
liff
.init({ liffId: '2006746651-DmRwZed0' })
.then(() => {
console.log('LIFF initialization is done')
console.log(liff.getAppLanguage())
console.log(liff.getVersion())
console.log(liff.isInClient())
console.log(liff.isLoggedIn())
console.log(liff.getOS())
console.log(liff.getLineVersion())
console.log('Is Logged In:', liff.isLoggedIn())
console.log('Access Token:', liff.getAccessToken())
if (!liff.isLoggedIn()) {
liff.login()
} else {
// Initialization successful, proceed with app logic
liff.getProfile().then((profile) => {
console.log('User Profile:', profile)
})
}

setIsLiffReady(true) // Ensure LIFF initialization is complete
})
.catch((error: any) => {
console.error(`LIFF initialization failed: ${error}`)
})
}

// initLiff()
// }, [])
initLiff()
}, [])

// useEffect(() => {
// if (!isLiffReady) {
Expand Down

0 comments on commit 60588f3

Please sign in to comment.