1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

update account context

This commit is contained in:
Tyler Myracle 2024-01-17 11:45:11 -06:00
parent da2d5997ac
commit 341ecc8508

View file

@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import * as Sentry from '@sentry/react' import * as Sentry from '@sentry/react'
import type { Logger } from '../providers/LogProvider' import type { Logger } from '../providers/LogProvider'
import toast from 'react-hot-toast' import toast from 'react-hot-toast'
import { useAccountContext } from '../providers'
import { useTellerApi } from '../api' import { useTellerApi } from '../api'
import type { import type {
TellerConnectEnrollment, TellerConnectEnrollment,
@ -45,6 +46,7 @@ export const useTellerConfig = (logger: Logger) => {
export const useTellerConnect = (options: TellerConnectOptions, logger: Logger) => { export const useTellerConnect = (options: TellerConnectOptions, logger: Logger) => {
const { useHandleEnrollment } = useTellerApi() const { useHandleEnrollment } = useTellerApi()
const handleEnrollment = useHandleEnrollment() const handleEnrollment = useHandleEnrollment()
const { setAccountManager } = useAccountContext()
const [loading, error] = useScript({ const [loading, error] = useScript({
src: TC_JS, src: TC_JS,
checkForExisting: true, checkForExisting: true,
@ -124,7 +126,7 @@ export const useTellerConnect = (options: TellerConnectOptions, logger: Logger)
logIt() logIt()
const tellerInstance = createTellerInstance(institutionId) const tellerInstance = createTellerInstance(institutionId)
tellerInstance.open() tellerInstance.open()
setTeller(tellerInstance) setAccountManager({ view: 'idle' })
}, },
} }
} }