phase 4: migrate ageAssurance unit and chat wrapper signatures to lex clients
This commit is contained in:
@@ -16,7 +16,7 @@ import {Trans} from '@lingui/react/macro'
|
||||
import {retry} from '#/lib/async/retry'
|
||||
import {wait} from '#/lib/async/wait'
|
||||
import {parseLinkingUrl} from '#/lib/parseLinkingUrl'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import {useAppviewClient, useSession} from '#/state/session'
|
||||
import {atoms as a, platform, useBreakpoints, useTheme} from '#/alf'
|
||||
import {AgeAssuranceBadge} from '#/components/ageAssurance/AgeAssuranceBadge'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
@@ -176,7 +176,8 @@ function Inner() {
|
||||
const t = useTheme()
|
||||
const ax = useAnalytics()
|
||||
const {_} = useLingui()
|
||||
const agent = useAgent()
|
||||
const {hasSession} = useSession()
|
||||
const appviewClient = useAppviewClient()
|
||||
const polling = useRef(false)
|
||||
const unmounted = useRef(false)
|
||||
const [error, setError] = useState(false)
|
||||
@@ -196,10 +197,10 @@ function Inner() {
|
||||
5,
|
||||
() => true,
|
||||
async () => {
|
||||
if (!agent.session) return
|
||||
if (!hasSession) return
|
||||
if (unmounted.current) return
|
||||
|
||||
const data = await refetchAgeAssuranceServerState({agent})
|
||||
const data = await refetchAgeAssuranceServerState({appviewClient})
|
||||
|
||||
if (data?.state.status !== 'assured') {
|
||||
throw new Error(
|
||||
@@ -214,7 +215,7 @@ function Inner() {
|
||||
)
|
||||
.then(async data => {
|
||||
if (!data) return
|
||||
if (!agent.session) return
|
||||
if (!hasSession) return
|
||||
if (unmounted.current) return
|
||||
|
||||
setSuccess(true)
|
||||
@@ -230,7 +231,7 @@ function Inner() {
|
||||
return () => {
|
||||
unmounted.current = true
|
||||
}
|
||||
}, [ax, agent])
|
||||
}, [ax, hasSession, appviewClient])
|
||||
|
||||
if (success) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user