mirror of
https://github.com/langgenius/dify.git
synced 2026-01-31 08:01:46 +08:00
23 lines
593 B
TypeScript
23 lines
593 B
TypeScript
import { useEffect } from 'react'
|
|
import { useTriggerSubscriptions } from '@/service/use-triggers'
|
|
import { usePluginStore, usePluginSubscriptionStore } from './store'
|
|
|
|
export const useSubscriptionList = () => {
|
|
const detail = usePluginStore(state => state.detail)
|
|
const { setRefresh } = usePluginSubscriptionStore()
|
|
|
|
const { data: subscriptions, isLoading, refetch } = useTriggerSubscriptions(detail?.provider || '')
|
|
|
|
useEffect(() => {
|
|
if (refetch)
|
|
setRefresh(refetch)
|
|
}, [refetch, setRefresh])
|
|
|
|
return {
|
|
detail,
|
|
subscriptions,
|
|
isLoading,
|
|
refetch,
|
|
}
|
|
}
|