Skip to content
Open
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
21 changes: 16 additions & 5 deletions src/utils/index2.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,22 @@ ${i + 1} of ${value.length}`

// eslint-disable-next-line consistent-return
export const handleDownload = async (input) => {
const { value, dispatch, setZip, setNotification, name, currentPlan } = input;
if (currentPlan === "free") {
dispatch(setToggleUpgradeModal(true));
return;
}
const { dispatch, setZip, setNotification, name, currentPlan } = input;
// transform attribute to metadata format
let value = input.value;
value = value.map(({ attributes, ...v }) => {
let transformAttribute = attributes.map((attr) => ({
trait_type: attr.trait_type,
value: attr.imageName,
rarity: attr.rarity,
}));
return { ...v, attributes: transformAttribute };
});

// if (currentPlan === "free") {
// dispatch(setToggleUpgradeModal(true));
// return;
// }
if (!name) {
return dispatch(
setNotification({
Expand Down