Skip to content

Commit

Permalink
Merge pull request #155 from PROCEED-Labs/ms2/fix-imports
Browse files Browse the repository at this point in the history
Fixed wrong import
  • Loading branch information
jjoderis authored Nov 16, 2023
2 parents c519254 + f7798e3 commit 955c16d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/management-system-v2/components/process-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ import useLastClickedStore from '@/lib/use-last-clicked-process-store';
import classNames from 'classnames';
import { generateDateString } from '@/lib/utils';
import ProcessEditButton from './process-edit-button';
import { AuthCan } from '@/lib/iamComponents';
import { toCaslResource } from '@/lib/ability/caslAbility';
import { ApiData, useDeleteAsset, useInvalidateAsset, usePostAsset } from '@/lib/fetch-data';
import { useUserPreferences } from '@/lib/user-preferences';
import ProcessDeleteSingleModal from './process-delete-single';
import { useAbilityStore } from '@/lib/abilityStore';
import { AuthCan } from '@/lib/clientAuthComponents';

type Processes = ApiData<'/process', 'get'>;
type Process = Processes[number];
Expand Down
11 changes: 5 additions & 6 deletions src/management-system-v2/lib/clientAuthComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use client';

import { ReactElement, ReactNode, useEffect, useMemo } from 'react';
import { ReactElement, ReactNode, useEffect, useMemo, FC, PropsWithChildren } from 'react';
import { useAbilityStore } from './abilityStore';
import { useSession } from 'next-auth/react';
import { Route } from 'next';
import { AbilityRule, ResourceActionType, ResourceType } from './ability/caslAbility';
import { AbilityRule, ResourceActionType } from './ability/caslAbility';
import { PackRule } from '@casl/ability/extra';
import { useCsrfTokenStore } from './csrfTokenStore';
import { useRouter } from 'next/navigation';
import Ability from './ability/abilityHelper';

export type AuthCanProps = {
action: ResourceActionType | ResourceActionType[];
resource: ResourceType | ResourceType[];
resource: Parameters<Ability['can']>[1];
notLoggedIn?: ReactElement;
fallback?: ReactElement;
fallbackRedirect?: Route;
Expand Down Expand Up @@ -40,16 +41,14 @@ export const FetchAbility = () => {
return <></>;
};

export const AuthCan = ({
export const AuthCan: FC<PropsWithChildren<AuthCanProps>> = ({
action,
resource,
fallback,
loading: loadingAuth,
notLoggedIn,
children,
fallbackRedirect,
}: AuthCanProps & {
children: ReactNode;
}) => {
const router = useRouter();
const { status } = useSession();
Expand Down

0 comments on commit 955c16d

Please sign in to comment.