From fa5c994ddcf0dfb02487083cecd774beb2dc53d2 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 18 Apr 2023 01:15:26 +0530 Subject: [PATCH] chore: remove redundant console logs (#868) --- apps/app/components/account/email-password-form.tsx | 2 +- apps/app/components/core/issues-view.tsx | 6 ------ apps/app/components/cycles/sidebar.tsx | 9 ++------- .../estimates/create-update-estimate-modal.tsx | 4 +--- apps/app/components/issues/activity.tsx | 5 +---- .../app/components/labels/create-update-label-inline.tsx | 3 +-- apps/app/components/labels/labels-list-modal.tsx | 5 +---- apps/app/components/modules/sidebar.tsx | 9 ++------- apps/app/components/onboarding/invite-members.tsx | 7 ++----- apps/app/components/project/single-integration-card.tsx | 1 - .../rich-text-editor/toolbar/float-tool-tip.tsx | 6 +----- .../workspace/send-workspace-invitation-modal.tsx | 5 ++--- apps/app/helpers/string.helper.ts | 6 +----- .../projects/[projectId]/modules/[moduleId].tsx | 7 ++----- .../projects/[projectId]/settings/labels.tsx | 7 +------ 15 files changed, 18 insertions(+), 64 deletions(-) diff --git a/apps/app/components/account/email-password-form.tsx b/apps/app/components/account/email-password-form.tsx index ca654c81c..91ef2b433 100644 --- a/apps/app/components/account/email-password-form.tsx +++ b/apps/app/components/account/email-password-form.tsx @@ -50,7 +50,7 @@ export const EmailPasswordForm = ({ onSuccess }: any) => { if (!error?.response?.data) return; Object.keys(error.response.data).forEach((key) => { const err = error.response.data[key]; - console.log("err", err); + console.log(err); setError(key as keyof EmailPasswordFormValues, { type: "manual", message: Array.isArray(err) ? err.join(", ") : err, diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index a964181cd..22261de06 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -315,9 +315,6 @@ export const IssuesView: React.FC = ({ cycleId as string, bridgeId ) - .then((res) => { - console.log(res); - }) .catch((e) => { console.log(e); }); @@ -338,9 +335,6 @@ export const IssuesView: React.FC = ({ moduleId as string, bridgeId ) - .then((res) => { - console.log(res); - }) .catch((e) => { console.log(e); }); diff --git a/apps/app/components/cycles/sidebar.tsx b/apps/app/components/cycles/sidebar.tsx index 6510b53c1..306ec5578 100644 --- a/apps/app/components/cycles/sidebar.tsx +++ b/apps/app/components/cycles/sidebar.tsx @@ -92,13 +92,8 @@ export const CycleDetailsSidebar: React.FC = ({ cyclesService .patchCycle(workspaceSlug as string, projectId as string, cycleId as string, data) - .then((res) => { - console.log(res); - mutate(CYCLE_DETAILS(cycleId as string)); - }) - .catch((e) => { - console.log(e); - }); + .then(() => mutate(CYCLE_DETAILS(cycleId as string))) + .catch((e) => console.log(e)); }; const handleCopyText = () => { diff --git a/apps/app/components/estimates/create-update-estimate-modal.tsx b/apps/app/components/estimates/create-update-estimate-modal.tsx index 2f2ac2c71..a8a191eca 100644 --- a/apps/app/components/estimates/create-update-estimate-modal.tsx +++ b/apps/app/components/estimates/create-update-estimate-modal.tsx @@ -94,9 +94,7 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, await estimatesService .patchEstimate(workspaceSlug as string, projectId as string, data?.id as string, payload) - .then(() => { - handleClose(); - }) + .then(() => handleClose()) .catch(() => { setToastAlert({ type: "error", diff --git a/apps/app/components/issues/activity.tsx b/apps/app/components/issues/activity.tsx index dd50f3bca..36fd19b42 100644 --- a/apps/app/components/issues/activity.tsx +++ b/apps/app/components/issues/activity.tsx @@ -157,10 +157,7 @@ export const IssueActivitySection: React.FC = () => { issueId as string, commentId ) - .then((response) => { - mutateIssueActivities(); - console.log(response); - }); + .then(() => mutateIssueActivities()); }; const getLabelColor = (labelId: string) => { diff --git a/apps/app/components/labels/create-update-label-inline.tsx b/apps/app/components/labels/create-update-label-inline.tsx index 24db3ab38..21c70f31c 100644 --- a/apps/app/components/labels/create-update-label-inline.tsx +++ b/apps/app/components/labels/create-update-label-inline.tsx @@ -78,8 +78,7 @@ export const CreateUpdateLabelInline = forwardRef(function CreateUpd labelToUpdate?.id ?? "", formData ) - .then((res) => { - console.log(res); + .then(() => { reset(defaultValues); mutate( PROJECT_ISSUE_LABELS(projectId as string), diff --git a/apps/app/components/labels/labels-list-modal.tsx b/apps/app/components/labels/labels-list-modal.tsx index 55ea3edc8..b2c687380 100644 --- a/apps/app/components/labels/labels-list-modal.tsx +++ b/apps/app/components/labels/labels-list-modal.tsx @@ -61,10 +61,7 @@ export const LabelsListModal: React.FC = ({ isOpen, handleClose, parent } .patchIssueLabel(workspaceSlug as string, projectId as string, label.id, { parent: parent?.id ?? "", }) - .then((res) => { - console.log(res); - mutate(); - }); + .then(() => mutate()); }; return ( diff --git a/apps/app/components/modules/sidebar.tsx b/apps/app/components/modules/sidebar.tsx index 492cdaa00..7811407dd 100644 --- a/apps/app/components/modules/sidebar.tsx +++ b/apps/app/components/modules/sidebar.tsx @@ -87,13 +87,8 @@ export const ModuleDetailsSidebar: React.FC = ({ issues, module, isOpen, modulesService .patchModule(workspaceSlug as string, projectId as string, moduleId as string, data) - .then((res) => { - console.log(res); - mutate(MODULE_DETAILS(moduleId as string)); - }) - .catch((e) => { - console.log(e); - }); + .then(() => mutate(MODULE_DETAILS(moduleId as string))) + .catch((e) => console.log(e)); }; const handleCreateLink = async (formData: ModuleLink) => { diff --git a/apps/app/components/onboarding/invite-members.tsx b/apps/app/components/onboarding/invite-members.tsx index 8ebce0a07..a731829b4 100644 --- a/apps/app/components/onboarding/invite-members.tsx +++ b/apps/app/components/onboarding/invite-members.tsx @@ -24,17 +24,14 @@ export const InviteMembers: React.FC = ({ setStep, workspace }) => { const onSubmit = async (formData: IUser) => { await workspaceService .inviteWorkspace(workspace.slug, formData) - .then((res) => { - console.log(res); + .then(() => { setToastAlert({ type: "success", title: "Invitations sent!", }); setStep(4); }) - .catch((err) => { - console.log(err); - }); + .catch((err) => console.log(err)); }; return ( diff --git a/apps/app/components/project/single-integration-card.tsx b/apps/app/components/project/single-integration-card.tsx index 4877f12a9..c8de0fe3e 100644 --- a/apps/app/components/project/single-integration-card.tsx +++ b/apps/app/components/project/single-integration-card.tsx @@ -58,7 +58,6 @@ export const SingleIntegration: React.FC = ({ integration }) => { url: html_url, }) .then((res) => { - console.log(res); mutate(PROJECT_GITHUB_REPOSITORY(projectId as string)); setToastAlert({ diff --git a/apps/app/components/rich-text-editor/toolbar/float-tool-tip.tsx b/apps/app/components/rich-text-editor/toolbar/float-tool-tip.tsx index 87f2427d3..034777794 100644 --- a/apps/app/components/rich-text-editor/toolbar/float-tool-tip.tsx +++ b/apps/app/components/rich-text-editor/toolbar/float-tool-tip.tsx @@ -51,11 +51,7 @@ export const CustomFloatingToolbar: React.FC = ({ gptOption, editorState {gptOption && (
-
diff --git a/apps/app/components/workspace/send-workspace-invitation-modal.tsx b/apps/app/components/workspace/send-workspace-invitation-modal.tsx index c4bcbff4e..b81023c2a 100644 --- a/apps/app/components/workspace/send-workspace-invitation-modal.tsx +++ b/apps/app/components/workspace/send-workspace-invitation-modal.tsx @@ -56,7 +56,6 @@ const SendWorkspaceInvitationModal: React.FC = ({ await workspaceService .inviteWorkspace(workspace_slug, { emails: [formData] }) .then((res) => { - console.log(res); setIsOpen(false); handleClose(); mutate(WORKSPACE_INVITATIONS, (prevData: any) => [ @@ -64,9 +63,9 @@ const SendWorkspaceInvitationModal: React.FC = ({ ...(prevData ?? []), ]); setToastAlert({ - title: "Success", type: "success", - message: "Member invited successfully", + title: "Success!", + message: "Member invited successfully.", }); }) .catch((err) => console.log(err)); diff --git a/apps/app/helpers/string.helper.ts b/apps/app/helpers/string.helper.ts index d3ae3ae26..ebb88f4df 100644 --- a/apps/app/helpers/string.helper.ts +++ b/apps/app/helpers/string.helper.ts @@ -36,11 +36,7 @@ const fallbackCopyTextToClipboard = (text: string) => { // FIXME: Even though we are using this as a fallback, execCommand is deprecated 👎. We should find a better way to do this. // https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand var successful = document.execCommand("copy"); - var msg = successful ? "successful" : "unsuccessful"; - console.log("Fallback: Copying text command was " + msg); - } catch (err) { - console.error("Fallback: Oops, unable to copy", err); - } + } catch (err) {} document.body.removeChild(textArea); }; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx index 172b049b3..e8b2daf9c 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx @@ -94,11 +94,8 @@ const SingleModule: React.FC = () => { await modulesService .addIssuesToModule(workspaceSlug as string, projectId as string, moduleId as string, data) - .then((res) => { - console.log(res); - mutate(MODULE_ISSUES(moduleId as string)); - }) - .catch((e) => + .then(() => mutate(MODULE_ISSUES(moduleId as string))) + .catch(() => setToastAlert({ type: "error", title: "Error!", diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx index d1f2e37e6..049345b94 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx @@ -81,12 +81,7 @@ const LabelsSettings: NextPage = () => { mutate((prevData) => prevData?.filter((p) => p.id !== labelId), false); issuesService .deleteIssueLabel(workspaceSlug as string, projectDetails.id, labelId) - .then((res) => { - console.log(res); - }) - .catch((e) => { - console.log(e); - }); + .catch((e) => console.log(e)); } };