refactor(FE-Storyless): remove console, window and err catch

This commit is contained in:
rstubryan
2025-11-27 13:46:53 +07:00
parent 4b6144d0b4
commit 7a76719547
4 changed files with 7 additions and 10 deletions
@@ -2924,8 +2924,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}, 1000); }, 1000);
} }
} }
} catch (error) { } catch {
console.error('Error creating recording:', error);
toast.error( toast.error(
'Gagal membuat recording. Silakan coba lagi.' 'Gagal membuat recording. Silakan coba lagi.'
); );
@@ -173,8 +173,7 @@ const GradingForm = ({ type = 'add', initialValues }: GradingFormProps) => {
deleteModal.closeModal(); deleteModal.closeModal();
toast.success(res?.message || 'Successfully delete Grading!'); toast.success(res?.message || 'Successfully delete Grading!');
router.push('/production/recording'); router.push('/production/recording');
} catch (err) { } catch {
console.error(err);
setGradingFormErrorMessage('Failed to delete Grading'); setGradingFormErrorMessage('Failed to delete Grading');
} finally { } finally {
setIsDeleteLoading(false); setIsDeleteLoading(false);
@@ -241,9 +241,8 @@ const PurchaseOrderStaffApprovalForm = ({
); );
formik.setFieldValue('items', updatedPurchaseItems); formik.setFieldValue('items', updatedPurchaseItems);
} }
} catch (error) { } catch {
toast.error('Terjadi kesalahan saat menghapus item pembelian'); toast.error('Terjadi kesalahan saat menghapus item pembelian');
console.error('Delete item error:', error);
} }
}, [ }, [
initialValues?.id, initialValues?.id,
@@ -12,6 +12,7 @@ import {
pdf, pdf,
} from '@react-pdf/renderer'; } from '@react-pdf/renderer';
import { Icon } from '@iconify/react'; import { Icon } from '@iconify/react';
import toast from 'react-hot-toast';
import Button from '@/components/Button'; import Button from '@/components/Button';
import { Purchase } from '@/types/api/purchase/purchase'; import { Purchase } from '@/types/api/purchase/purchase';
@@ -251,7 +252,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
const handleDownloadPDF = async () => { const handleDownloadPDF = async () => {
if (!purchaseData) { if (!purchaseData) {
alert('No purchase order data available'); toast.error('No purchase order data available');
return; return;
} }
@@ -502,9 +503,8 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
} catch (error) { } catch {
console.error('Error generating PDF:', error); toast.error('Failed to generate PDF. Please try again.');
alert('Failed to generate PDF. Please try again.');
} finally { } finally {
setIsGeneratingPDF(false); setIsGeneratingPDF(false);
} }