Lint all the things
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import { Progress, Result, Space, Upload } from "antd";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -32,7 +32,7 @@ export function DocumentsUploadComponent({
|
||||
const notification = useNotification();
|
||||
|
||||
const pct = useMemo(() => {
|
||||
return parseInt((totalSize / ((bodyshop && bodyshop.jobsizelimit) || 1)) * 100);
|
||||
return parseInt((totalSize / (bodyshop?.jobsizelimit || 1)) * 100, 10);
|
||||
}, [bodyshop, totalSize]);
|
||||
|
||||
if (pct > 100 && !ignoreSizeLimit)
|
||||
@@ -63,7 +63,7 @@ export function DocumentsUploadComponent({
|
||||
beforeUpload={(file, fileList) => {
|
||||
if (ignoreSizeLimit) return true;
|
||||
const newFiles = fileList.reduce((acc, val) => acc + val.size, 0);
|
||||
const shouldStopUpload = (totalSize + newFiles) / ((bodyshop && bodyshop.jobsizelimit) || 1) >= 1;
|
||||
const shouldStopUpload = (totalSize + newFiles) / (bodyshop?.jobsizelimit || 1) >= 1;
|
||||
|
||||
//Check to see if old files plus newly uploaded ones will be too much.
|
||||
if (shouldStopUpload) {
|
||||
@@ -109,7 +109,7 @@ export function DocumentsUploadComponent({
|
||||
{t("documents.labels.usage", {
|
||||
percent: pct,
|
||||
used: formatBytes(totalSize),
|
||||
total: formatBytes(bodyshop && bodyshop.jobsizelimit)
|
||||
total: formatBytes(bodyshop?.jobsizelimit)
|
||||
})}
|
||||
</span>
|
||||
</Space>
|
||||
|
||||
@@ -57,7 +57,7 @@ export const uploadToCloudinary = async (
|
||||
});
|
||||
|
||||
if (signedURLResponse.status !== 200) {
|
||||
if (!!onError) onError(signedURLResponse.statusText);
|
||||
if (onError) onError(signedURLResponse.statusText);
|
||||
notification["error"]({
|
||||
message: i18n.t("documents.errors.getpresignurl", {
|
||||
message: signedURLResponse.statusText
|
||||
@@ -71,7 +71,7 @@ export const uploadToCloudinary = async (
|
||||
var options = {
|
||||
headers: { "X-Requested-With": "XMLHttpRequest" },
|
||||
onUploadProgress: (e) => {
|
||||
if (!!onProgress) onProgress({ percent: (e.loaded / e.total) * 100 });
|
||||
if (onProgress) onProgress({ percent: (e.loaded / e.total) * 100 });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ export const uploadToCloudinary = async (
|
||||
);
|
||||
|
||||
if (cloudinaryUploadResponse.status !== 200) {
|
||||
if (!!onError) {
|
||||
if (onError) {
|
||||
onError(cloudinaryUploadResponse.statusText);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,9 @@ export const uploadToCloudinary = async (
|
||||
user: store.getState().user.email,
|
||||
object: cloudinaryUploadResponse
|
||||
});
|
||||
} catch (error) {}
|
||||
} catch {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
notification["error"]({
|
||||
message: i18n.t("documents.errors.insert", {
|
||||
@@ -123,7 +125,7 @@ export const uploadToCloudinary = async (
|
||||
const exif = await exifr.parse(file);
|
||||
|
||||
takenat = exif && exif.DateTimeOriginal;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
console.log("Unable to parse image file for EXIF Data");
|
||||
}
|
||||
}
|
||||
@@ -146,7 +148,7 @@ export const uploadToCloudinary = async (
|
||||
}
|
||||
});
|
||||
if (!documentInsert.errors) {
|
||||
if (!!onSuccess)
|
||||
if (onSuccess)
|
||||
onSuccess({
|
||||
uid: documentInsert.data.insert_documents.returning[0].id,
|
||||
name: documentInsert.data.insert_documents.returning[0].name,
|
||||
@@ -162,7 +164,7 @@ export const uploadToCloudinary = async (
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
if (!!onError) onError(JSON.stringify(documentInsert.errors));
|
||||
if (onError) onError(JSON.stringify(documentInsert.errors));
|
||||
notification["error"]({
|
||||
message: i18n.t("documents.errors.insert", {
|
||||
message: JSON.stringify(documentInsert.errors)
|
||||
|
||||
Reference in New Issue
Block a user