github
1384 of 2743 branches covered (50.46%)
4 of 1054 new or added lines in 51 files covered. (0.38%)
1 existing line in 1 file now uncovered.13872 of 75186 relevant lines covered (18.45%)
1.85 hits per line
NEW
|
import { useQuery } from '@tanstack/react-query'; |
|
NEW
|
import { getSetting } from '@teable/openapi'; |
× |
NEW
|
import { useSession } from '@teable/sdk/hooks'; |
× |
NEW
|
|
× |
NEW
|
export const useSetting = () => { |
× |
NEW
|
const { user } = useSession();
|
× |
NEW
|
const { data: setting, isLoading } = useQuery({ |
× |
NEW
|
queryKey: ['setting'], |
× |
NEW
|
queryFn: () => getSetting().then(({ data }) => data), |
× |
NEW
|
}); |
× |
NEW
|
|
× |
NEW
|
const { disallowSignUp = false, disallowSpaceCreation = false } = setting ?? {}; |
× |
NEW
|
|
× |
NEW
|
return {
|
× |
NEW
|
disallowSignUp, |
× |
NEW
|
disallowSpaceCreation: !user.isAdmin && (isLoading || disallowSpaceCreation), |
× |
NEW
|
}; |
× |
NEW
|
}; |
× |