2023-01-11 06:10:05 +00:00
|
|
|
export function getCardByGuid(cards, guid) {
|
|
|
|
let card = null;
|
2023-01-12 19:30:01 +00:00
|
|
|
cards.forEach((value, key, map) => {
|
2023-01-11 06:10:05 +00:00
|
|
|
if(value?.data?.cardProfile?.guid === guid) {
|
|
|
|
card = value;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return card;
|
|
|
|
}
|
|
|
|
|
2023-01-12 19:30:01 +00:00
|
|
|
export function getProfileByGuid(cards, guid) {
|
|
|
|
const card = getCardByGuid(cards, guid);
|
2023-01-11 06:10:05 +00:00
|
|
|
if (card?.data?.cardProfile) {
|
2023-01-25 18:56:43 +00:00
|
|
|
const { name, handle, imageSet, node } = card.data.cardProfile;
|
2023-01-11 06:10:05 +00:00
|
|
|
const cardId = card.id;
|
2023-01-25 18:56:43 +00:00
|
|
|
return { cardId, name, handle, imageSet, node }
|
2023-01-11 06:10:05 +00:00
|
|
|
}
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|