Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ mutation createProduct($input: CreateProductInput!) {
}
`;

const CSV_FILE_TYPES = [
"text/csv",
"text/plain",
"text/x-csv",
"application/vnd.ms-excel",
"application/csv",
"application/x-csv",
"text/comma-separated-values",
"text/x-comma-separated-values",
"text/tab-separated-values"
];

/**
* ProductTable component
* @returns {Node} React node
Expand Down Expand Up @@ -94,10 +106,11 @@ function ProductTable() {
};

const { getRootProps, getInputProps } = useDropzone({
onDrop,
multiple: true,
accept: CSV_FILE_TYPES,
disableClick: true,
disablePreview: true,
disableClick: true
multiple: true,
onDrop
});

const handleShowFilterByFile = (isVisible) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ const useStyles = makeStyles({
}
});

const CSV_FILE_TYPES = [
"text/csv",
"text/plain",
"text/x-csv",
"application/vnd.ms-excel",
"application/csv",
"application/x-csv",
"text/comma-separated-values",
"text/x-comma-separated-values",
"text/tab-separated-values"
];

/**
* @summary Main products view
* @name ProductsTable
Expand Down Expand Up @@ -182,11 +194,13 @@ function ProductsTable() {

// Filter by file event handlers
const { getRootProps, getInputProps } = useDropzone({
onDrop,
multiple: false,
accept: CSV_FILE_TYPES,
disableClick: true,
disablePreview: true,
disableClick: true
multiple: false,
onDrop
});

const importFiles = (newFiles) => {
let productIds = [];

Expand Down