github
1384 of 2736 branches covered (50.58%)
4 of 785 new or added lines in 43 files covered. (0.51%)
7 existing lines in 3 files now uncovered.13872 of 74920 relevant lines covered (18.52%)
1.85 hits per line
NEW
|
import { useQuery } from '@tanstack/react-query'; |
|
NEW
|
import { getSetting } from '@teable/openapi'; |
× |
NEW
|
import { useIsEE } from './useIsEE'; |
× |
NEW
|
|
× |
NEW
|
export const useSetting = () => { |
× |
NEW
|
const isEE = useIsEE();
|
× |
NEW
|
const { data: setting, isLoading } = useQuery({ |
× |
NEW
|
queryKey: ['setting'], |
× |
NEW
|
queryFn: () => getSetting().then(({ data }) => data), |
× |
NEW
|
enabled: isEE, |
× |
NEW
|
}); |
× |
NEW
|
|
× |
NEW
|
const {
|
× |
NEW
|
disallowSignUp = false,
|
× |
NEW
|
disallowResetPassword = false,
|
× |
NEW
|
disallowSpaceCreation = false,
|
× |
NEW
|
} = setting ?? {}; |
× |
NEW
|
|
× |
NEW
|
return {
|
× |
NEW
|
disallowSignUp, |
× |
NEW
|
disallowResetPassword: (isEE && isLoading) || disallowResetPassword, |
× |
NEW
|
disallowSpaceCreation: (isEE && isLoading) || disallowSpaceCreation, |
× |
NEW
|
}; |
× |
NEW
|
}; |
× |