refactor: ♻️ Toast component
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Flex, useDisclosure, useToast } from '@chakra-ui/react'
|
||||
import { Flex, useDisclosure } from '@chakra-ui/react'
|
||||
import { StatsCards } from 'components/analytics/StatsCards'
|
||||
import { Graph } from 'components/shared/Graph'
|
||||
import { useToast } from 'components/shared/hooks/useToast'
|
||||
import { UpgradeModal } from 'components/shared/modals/UpgradeModal'
|
||||
import { GraphProvider } from 'contexts/GraphContext'
|
||||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
||||
@ -11,14 +12,10 @@ import { useAnswersCount } from 'services/analytics'
|
||||
export const AnalyticsContent = ({ stats }: { stats?: Stats }) => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||
const { typebot, publishedTypebot } = useTypebot()
|
||||
|
||||
const toast = useToast({
|
||||
position: 'top-right',
|
||||
status: 'error',
|
||||
})
|
||||
const { showToast } = useToast()
|
||||
const { answersCounts } = useAnswersCount({
|
||||
typebotId: publishedTypebot && typebot?.id,
|
||||
onError: (err) => toast({ title: err.name, description: err.message }),
|
||||
onError: (err) => showToast({ title: err.name, description: err.message }),
|
||||
})
|
||||
return (
|
||||
<Flex
|
||||
|
Reference in New Issue
Block a user