Skip to content

Commit

Permalink
Improve the code
Browse files Browse the repository at this point in the history
  • Loading branch information
piyumaldk committed Nov 20, 2023
1 parent af5e569 commit 0232fa2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const Listing: React.FC = () => {
const fetchGlobalPolicies = () => {
setLoading(true);
// Due to a bug in current backend, we pass 0, 10 as a workaround for now
const promisedPolicies = API.getAllGatewayPolicies(0, 10);
const promisedPolicies = API.getAllGatewayPolicies(0, 30);
promisedPolicies
.then((response: any) => {
setPolicies(response.body.list);
Expand Down Expand Up @@ -323,8 +323,8 @@ const Listing: React.FC = () => {
APIMAlert.error(response.body.message);
}
})
.catch((/* error */) => {
// console.error(error);
.catch((error) => {
console.error(error);
if (deploying) {
APIMAlert.error('Error occurred while deploying the policy');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const DraggablePolicyCard: React.FC<DraggablePolicyCardProps> = ({
}) => {
const [hovered, setHovered] = useState(false);
const classes = useStyles();
/**
* React DnD Library has been used here.
* React DnD hook to make the policy card draggable.
*/
const [{ isDragging }, drag] = useDrag(
() => ({
type: `policyCard-${policyObj.id}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const PolicyDropzone: FC<PolicyDropzoneProps> = ({
const [droppedPolicy, setDroppedPolicy] = useState<Policy | null>(null);

/**
* React DnD Library has been used here.
* Drop handler for the dropzone.
* This will set the dropped policy to the state.
* This data will be sent to the lower level components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,6 @@ class API extends Resource {
const requestBody = {
requestBody: body,
};
console.log(body);
return restApiClient.then(client => {
return client.apis['Gateway Policies'].engageGlobalPolicy(
{gatewayPolicyMappingId},
Expand Down

0 comments on commit 0232fa2

Please sign in to comment.