updateObjectID( index, newObjectID ) {
		const {
			attributes,
			setAttributes
		} = this.props;

		const {
			objectData
		} = attributes;

		if ( objectData[ index ].objectID != newObjectID ) {
			const base_rest_path = '/wp-museum/v1/';
			const newObjectData  = objectData.concat();
			
			// Reset data for the object.
			newObjectData[ index ] = {
				objectID    : newObjectID,
				imgURL      : null,
				imgIndex    : 0,
				objectURL   : null,
				objectTitle : null,
			}

			setAttributes( { objectData: newObjectData } );

			//Fetch new data for the object.
			if ( newObjectID ) {
				const object_path = base_rest_path + 'all/' + newObjectID;
				apiFetch( { path: object_path } ).then( result => {
					const newNewObjectData              = newObjectData.concat();
					newNewObjectData[index].objectURL   = result['link'];
					newNewObjectData[index].objectTitle = result['post_title'];

					setAttributes( { objectData: newNewObjectData } );
				} );
			}
		}
	}
/**
	 * Updates the WordPress post_id for a particular image and then fetches
	 * data for that object from the REST api.
	 *
	 * @param {number}        index       The array index of the image.
	 * @param {number | null} newObjectID New WordPress post_id associated with
	 *                                    that image. If null, reset all of the
	 *                                    data for that index.
	 */
Updates the WordPress post_id for a particular image and then fetches
data for that object from the REST api.

@param {number}        index       The array index of the image.
@param {number | null} newObjectID New WordPress post_id associated with
that image. If null, reset all of the
data for that index.
Updates the WordPress post_id for a particular image and then fetches data for that object from the REST api . @param { number } index The array index of the image . @param { number | null } newObjectID New WordPress post_id associated with that image . If null reset all of the data for that index .
updateObjectID( index, newObjectID ) {
		const {
			attributes,
			setAttributes
		} = this.props;
		const {
			objectData
		} = attributes;
		if ( objectData[ index ].objectID != newObjectID ) {
			const base_rest_path = '/wp-museum/v1/';
			const newObjectData  = objectData.concat();
			newObjectData[ index ] = {
				objectID    : newObjectID,
				imgURL      : null,
				imgIndex    : 0,
				objectURL   : null,
				objectTitle : null,
			}
			setAttributes( { objectData: newObjectData } );
			if ( newObjectID ) {
				const object_path = base_rest_path + 'all/' + newObjectID;
				apiFetch( { path: object_path } ).then( result => {
					const newNewObjectData              = newObjectData.concat();
					newNewObjectData[index].objectURL   = result['link'];
					newNewObjectData[index].objectTitle = result['post_title'];
					setAttributes( { objectData: newNewObjectData } );
				} );
			}
		}
	}
updateObjectID ( index , newObjectID ) { const { attributes , setAttributes } = this . props ; const { objectData } = attributes ; if ( objectData [ index ] . objectID != newObjectID ) { const base_rest_path = '/wp-museum/v1/' ; const newObjectData = objectData . concat ( ) ; newObjectData [ index ] = { objectID : newObjectID , imgURL : null , imgIndex : 0 , objectURL : null , objectTitle : null , } setAttributes ( { objectData : newObjectData } ) ; if ( newObjectID ) { const object_path = base_rest_path + 'all/' + newObjectID ; apiFetch ( { path : object_path } ) . then ( result => { const newNewObjectData = newObjectData . concat ( ) ; newNewObjectData [ index ] . objectURL = result [ 'link' ] ; newNewObjectData [ index ] . objectTitle = result [ 'post_title' ] ; setAttributes ( { objectData : newNewObjectData } ) ; } ) ; } } }
Updates the WordPress post_id for a particular image and then fetches
 data for that object from the REST api.
Updates the WordPress post_id for a particular image and then fetches data for that object from the REST api .
// Reset data for the object. //Fetch new data for the object.