github
1381 of 2787 branches covered (49.55%)
15 of 112 new or added lines in 11 files covered. (13.39%)
13889 of 77479 relevant lines covered (17.93%)
1.79 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
|
}; |
× |