import React from 'react';
import PubSub from 'pubsub-js';
import LocationCard from '../common/LocationCard';


/** * 更新标记位置 * * 
 * @param {Object} data - 根据data.type类型，将不同的标记按照data.data移动 * 
*/
export default function updateMarkerPos(data) {
  if (data.type === "card") {
    // let cards = data.data.map(card => {
    //   return new LocationCard(...card);
    // });
    let cards = data.data.map(card => {
      return new LocationCard(card.lat, card.lng, card.render_id, card.locTime, card.card_id, card.info, card.src);
    });
    PubSub.publish('body.data.update', cards);
  }
}
