Skip to content

Commit

Permalink
feat: save published items
Browse files Browse the repository at this point in the history
  • Loading branch information
cazala committed Sep 17, 2021
1 parent 3e27cb0 commit feec069
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
9 changes: 2 additions & 7 deletions src/modules/item/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,14 @@ export function* itemSaga(builder: BuilderAPI) {
if (!isValidText(item.name) || !isValidText(item.description)) {
throw new Error(t('sagas.item.invalid_character'))
}
if (item.isPublished) {
throw new Error(t('sagas.item.cant_save_published'))
}
const finalSize: number = yield call(calculateFinalSize, item, contents)
if (finalSize > MAX_FILE_SIZE) {
throw new ItemTooBigError()
}

yield call(() => builder.saveItem(item, contents))
yield call(builder.saveItem, item, contents)

yield put(saveItemSuccess(item, contents))
yield put(closeModal('CreateItemModal'))
yield put(closeModal('EditPriceAndBeneficiaryModal'))
} catch (error) {
yield put(saveItemFailure(actionItem, contents, error.message))
}
Expand Down Expand Up @@ -189,7 +184,7 @@ export function* itemSaga(builder: BuilderAPI) {
collection.editItemsData([item.tokenId!], [item.price!], [item.beneficiary!], [metadata])
)
} else {
yield put(deployItemContentsRequest(collection, item))
yield put(saveItemRequest(item, contents))
}

yield put(savePublishedItemSuccess(item, maticChainId, txHash))
Expand Down
10 changes: 1 addition & 9 deletions src/modules/item/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,7 @@ export function canManageItem(collection: Collection, item: Item, address?: stri
}

export function hasOnChainDataChanged(originalItem: Item, item: Item) {
return (
originalItem.name !== item.name ||
originalItem.description !== item.description ||
originalItem.data.category !== item.data.category ||
originalItem.price !== item.price ||
originalItem.beneficiary !== item.beneficiary ||
originalItem.rarity !== item.rarity ||
JSON.stringify(getBodyShapes(originalItem)) !== JSON.stringify(getBodyShapes(item))
)
return originalItem.price !== item.price || originalItem.beneficiary !== item.beneficiary
}

export function getThumbnailURL(item: Item) {
Expand Down

0 comments on commit feec069

Please sign in to comment.