Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SujanSanjula96 committed Oct 26, 2023
1 parent 04d4995 commit 8998fa5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import { AuthorizedPermissionListItemInterface } from "../models/api-authorizati
* @throws `IdentityAppsApiException`
*/
const useScopesOfAPIResources = <Data = AuthorizedPermissionListItemInterface[], Error = RequestErrorInterface>(
apiResourceId: string,
shouldFetch?: boolean
apiResourceId: string
): RequestResultInterface<Data, Error> => {

const requestConfig: AxiosRequestConfig = {
Expand All @@ -46,7 +45,7 @@ const useScopesOfAPIResources = <Data = AuthorizedPermissionListItemInterface[],
url: `${ store.getState().config.endpoints.apiResources }/${ apiResourceId }/scopes`
};

const { data, error, isValidating, mutate } = useRequest<Data, Error>(shouldFetch ? requestConfig: null);
const { data, error, isValidating, mutate } = useRequest<Data, Error>(apiResourceId ? requestConfig: null);

return {
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const ScopeForm: FunctionComponent<ScopeFormInterface> = (
data: currentAPIResourceScopeListData,
isLoading: isCurrentAPIResourceScopeListDataLoading,
error: currentAPIResourceScopeListFetchError
} = useScopesOfAPIResources(subscribedAPIResource?.id, subscribedAPIResource?.id != null);
} = useScopesOfAPIResources(subscribedAPIResource?.id);

/**
* The following useEffect is used to handle if any error occurs while fetching API resource scopes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const AuthorizeAPIResource: FunctionComponent<AuthorizeAPIResourcePropsIn
isLoading: isCurrentAPIResourceScopeListDataLoading,
error: currentAPIResourceScopeListFetchError,
mutate: mutatecurrentAPIResourceScopeList
} = useScopesOfAPIResources(selectedAPIResource?.id, selectedAPIResource?.id != null);
} = useScopesOfAPIResources(selectedAPIResource?.id);

/**
* The following useEffect is used to handle if any error occurs while fetching API resources.
Expand Down

0 comments on commit 8998fa5

Please sign in to comment.