Skip to content

Commit

Permalink
chore: remove console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fratzinger committed Nov 27, 2022
1 parent fe66a1b commit 8a01e75
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/hooks/authorize/authorize.hook.after.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,19 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(
options: AuthorizeHookOptions
) => {
if (shouldSkip(HOOKNAME, context, options) || !context.params) {
context.type === null && console.log(context.type);
return context;
}

// eslint-disable-next-line prefer-const
let { isArray, items } = getItemsIsArray(context);
if (!items.length) {
context.type === null && console.log(context.type, "no items");
return context;
}

options = makeOptions(context.app, options);

const modelName = getModelName(options.modelName, context);
if (!modelName) {
context.type === null && console.log(context.type, "No model name found");
return context;
}

Expand All @@ -69,7 +66,6 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(

params.ability = await getAbility(context, options);
if (!params.ability) {
context.type === null && console.log(context.type, "no ability");
// Ignore internal or not authenticated requests
return context;
}
Expand All @@ -95,8 +91,6 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(
);
if ($newSelect) {
const _items = await refetchItems(context);
context.type === null &&
console.log(context.type, "refetch items", _items);
if (_items) {
items = _items;
}
Expand All @@ -118,9 +112,6 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(
hasRestrictingFieldsOptions
);

context.type === null &&
console.log("pickFields", fields, skipCheckFields, $select);

if (fields === true) {
// full restriction
return {};
Expand All @@ -129,8 +120,6 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(
return item;
} else if (fields && $select) {
fields = mergeArrays(fields, $select, "intersect") as string[];
context.type === null &&
console.log("mergedFields", fields, skipCheckFields, $select);
} else {
fields = fields ? fields : $select;
}
Expand All @@ -144,8 +133,6 @@ export const authorizeAfter = async <H extends HookContext = HookContext>(
for (let i = 0, n = items.length; i < n; i++) {
const item = pickFieldsForItem(items[i]);

context.type === null && console.log(item);

if (item) {
result.push(item);
}
Expand Down

0 comments on commit 8a01e75

Please sign in to comment.