disable notion by default
This commit is contained in:
@ -176,7 +176,7 @@ export default function Integrations(): JSX.Element {
|
||||
token,
|
||||
name: 'NOTION',
|
||||
type: 'EXPORT',
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
})
|
||||
|
||||
showSuccessToast('Connected with Notion.')
|
||||
|
||||
@ -12,7 +12,7 @@ import 'antd/dist/antd.compact.css'
|
||||
import { CheckboxValueType } from 'antd/lib/checkbox/Group'
|
||||
import Image from 'next/image'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { HStack, VStack } from '../../../components/elements/LayoutPrimitives'
|
||||
import { PageMetaData } from '../../../components/patterns/PageMetaData'
|
||||
import { Beta } from '../../../components/templates/Beta'
|
||||
@ -20,10 +20,7 @@ import { Header } from '../../../components/templates/settings/SettingsTable'
|
||||
import { SettingsLayout } from '../../../components/templates/SettingsLayout'
|
||||
import { deleteIntegrationMutation } from '../../../lib/networking/mutations/deleteIntegrationMutation'
|
||||
import { setIntegrationMutation } from '../../../lib/networking/mutations/setIntegrationMutation'
|
||||
import {
|
||||
Integration,
|
||||
useGetIntegrationsQuery,
|
||||
} from '../../../lib/networking/queries/useGetIntegrationsQuery'
|
||||
import { useGetIntegrationsQuery } from '../../../lib/networking/queries/useGetIntegrationsQuery'
|
||||
import { applyStoredTheme } from '../../../lib/themeUpdater'
|
||||
import { showSuccessToast } from '../../../lib/toastHelpers'
|
||||
|
||||
@ -39,27 +36,21 @@ export default function Notion(): JSX.Element {
|
||||
|
||||
const router = useRouter()
|
||||
const { integrations, revalidate } = useGetIntegrationsQuery()
|
||||
const [notion, setNotion] = useState<Integration>()
|
||||
const notion = useMemo(() => {
|
||||
return integrations.find((i) => i.name == 'NOTION' && i.type == 'EXPORT')
|
||||
}, [integrations])
|
||||
|
||||
const [form] = Form.useForm<FieldType>()
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
|
||||
useEffect(() => {
|
||||
const notion = integrations.find(
|
||||
(i) => i.name == 'NOTION' && i.type == 'EXPORT'
|
||||
)
|
||||
|
||||
if (notion) {
|
||||
setNotion(notion)
|
||||
|
||||
form.setFieldsValue({
|
||||
parentPageId: notion.settings?.parentPageId,
|
||||
parentDatabaseId: notion.settings?.parentDatabaseId,
|
||||
enabled: notion.enabled,
|
||||
properties: notion.settings?.properties,
|
||||
})
|
||||
}
|
||||
}, [form, integrations])
|
||||
form.setFieldsValue({
|
||||
parentPageId: notion?.settings?.parentPageId,
|
||||
parentDatabaseId: notion?.settings?.parentDatabaseId,
|
||||
enabled: notion?.enabled,
|
||||
properties: notion?.settings?.properties,
|
||||
})
|
||||
}, [form, notion])
|
||||
|
||||
const deleteNotion = async () => {
|
||||
if (!notion) {
|
||||
@ -69,6 +60,7 @@ export default function Notion(): JSX.Element {
|
||||
await deleteIntegrationMutation(notion.id)
|
||||
showSuccessToast('Notion integration disconnected successfully.')
|
||||
|
||||
revalidate()
|
||||
router.push('/settings/integrations')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user