Improve docs

This commit is contained in:
Kimmo Puputti 2017-08-15 10:41:53 +03:00
parent a61df5211e
commit d52cbd39f6
2 changed files with 11 additions and 2 deletions

View file

@ -251,6 +251,9 @@ export function requestImageUpload(actionPayload) {
};
}
// Update the given tab of the wizard with the given data. This saves
// the data to the listing, and marks the tab updated so the UI can
// display the state.
export function requestUpdateListing(tab, data) {
return (dispatch, getState, sdk) => {
dispatch(updateListing(data));
@ -271,11 +274,14 @@ export function requestUpdateListing(tab, data) {
};
}
// loadData is run for each tab of the wizard. When editing an
// existing listing, the listing must be fetched first.
export function loadData(params) {
return dispatch => {
dispatch(clearUpdatedTab());
const { id, type } = params;
if (type === 'new') {
// No need to fetch anything when creating a new listing
return Promise.resolve(null);
}
const payload = {

View file

@ -103,8 +103,11 @@ export const EditListingPageComponent = props => {
// Images are passed to EditListingForm so that it can generate thumbnails out of them
const currentListingImages = currentListing ? currentListing.images : [];
const draftImages = page.imageOrder.map(i => page.images[i]);
const images = currentListingImages.concat(draftImages);
// Images not yet connected to the listing
const unattachedImages = page.imageOrder.map(i => page.images[i]);
const images = currentListingImages.concat(unattachedImages);
const title = isNew
? intl.formatMessage({ id: 'EditListingPage.titleCreateListing' })