github
1297 of 2652 branches covered (48.91%)
15 of 115 new or added lines in 12 files covered. (13.04%)
2 existing lines in 1 file now uncovered.13234 of 75486 relevant lines covered (17.53%)
1.84 hits per line
NEW
|
import type { QueryClient } from '@tanstack/react-query'; |
|
NEW
|
import type { SpaceRole } from '@teable/core'; |
× |
NEW
|
import type { IGetSpaceVo } from '@teable/openapi'; |
× |
NEW
|
|
× |
NEW
|
export const spaceRoleChecker = ({ |
× |
NEW
|
queryClient, |
× |
NEW
|
spaceId, |
× |
NEW
|
roles, |
× |
NEW
|
}: { |
× |
NEW
|
queryClient: QueryClient;
|
× |
NEW
|
spaceId: string; |
× |
NEW
|
roles: SpaceRole[];
|
× |
NEW
|
}) => { |
× |
NEW
|
const role = (queryClient.getQueryState(['space', spaceId as string])?.data as IGetSpaceVo)?.role; |
× |
NEW
|
|
× |
NEW
|
if (!roles.includes(role)) {
|
× |
NEW
|
return {
|
× |
NEW
|
redirect: {
|
× |
NEW
|
destination: '/403', |
× |
NEW
|
permanent: false,
|
× |
NEW
|
}, |
× |
NEW
|
}; |
× |
NEW
|
} |
× |
NEW
|
}; |
× |