mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
* **Chores** * Updated internal module import paths across hook files to use standardized path aliases for improved code consistency and maintainability.
24 lines
823 B
TypeScript
24 lines
823 B
TypeScript
import { useMemo } from 'react'
|
|
|
|
import { extractMethod } from '@/components/interfaces/Auth/Hooks/hooks.utils'
|
|
import { AuthConfigResponse, useAuthConfigQuery } from '@/data/auth/auth-config-query'
|
|
|
|
function authConfigToCustomAccessTokenHookDetails(authConfig?: AuthConfigResponse) {
|
|
if (!authConfig || !authConfig.HOOK_CUSTOM_ACCESS_TOKEN_ENABLED) {
|
|
return undefined
|
|
}
|
|
|
|
return extractMethod(
|
|
authConfig.HOOK_CUSTOM_ACCESS_TOKEN_URI,
|
|
authConfig.HOOK_CUSTOM_ACCESS_TOKEN_SECRETS
|
|
)
|
|
}
|
|
|
|
export function useCustomAccessTokenHookDetails(projectRef: string | undefined) {
|
|
const { data: authConfig } = useAuthConfigQuery({ projectRef })
|
|
|
|
return useMemo(() => authConfigToCustomAccessTokenHookDetails(authConfig), [authConfig])
|
|
}
|
|
|
|
export type CustomAccessTokenHookDetails = ReturnType<typeof extractMethod>
|