feat: refactoring casl permission checks for recursive nested operations (#778)
* feat: nested casl abilities * fix: remove unused packages * Fixes * Fix createMany broken * Fix lint * Fix lint * Fix lint * Fix lint * Fixes * Fix CommentThread * Fix bugs * Fix lint * Fix bugs * Fixed auto routing * Fixed app path --------- Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -5,6 +5,7 @@ import { useAuth } from '@/auth/hooks/useAuth';
|
||||
import { useIsLogged } from '@/auth/hooks/useIsLogged';
|
||||
|
||||
import { AppPath } from '../../modules/types/AppPath';
|
||||
import { isNonEmptyString } from '../../utils/isNonEmptyString';
|
||||
|
||||
export function Verify() {
|
||||
const [searchParams] = useSearchParams();
|
||||
@ -20,8 +21,17 @@ export function Verify() {
|
||||
if (!loginToken) {
|
||||
navigate(AppPath.SignIn);
|
||||
} else {
|
||||
await verify(loginToken);
|
||||
navigate(AppPath.CompaniesPage);
|
||||
const verifyResponse = await verify(loginToken);
|
||||
|
||||
if (
|
||||
isNonEmptyString(
|
||||
verifyResponse.user.workspaceMember?.workspace.displayName,
|
||||
)
|
||||
) {
|
||||
navigate(AppPath.Index);
|
||||
} else {
|
||||
navigate(AppPath.CreateWorkspace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user