mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
datasource change authed page
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from '@tanstack/react-query'
|
||||
import { get } from './base'
|
||||
import { useInvalid } from './use-base'
|
||||
import type { DataSourceAuth } from '@/app/components/header/account-setting/data-source-page-new/types'
|
||||
@ -31,3 +34,18 @@ export const useInvalidDefaultDataSourceListAuth = (
|
||||
) => {
|
||||
return useInvalid([NAME_SPACE, 'default-list'])
|
||||
}
|
||||
export const useGetDataSourceOAuthUrl = (
|
||||
provider: string,
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'oauth-url', provider],
|
||||
mutationFn: (credentialId?: string) => {
|
||||
return get<
|
||||
{
|
||||
authorization_url: string
|
||||
state: string
|
||||
context_id: string
|
||||
}>(`/oauth/plugin/${provider}/datasource/get-authorization-url?credential_id=${credentialId}`)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user