Skip to content

Commit

Permalink
Merge pull request #122 from adobecom/dev
Browse files Browse the repository at this point in the history
Dev -> Stage July 25 #3
  • Loading branch information
rayyank10 authored Jul 25, 2024
2 parents c7ba609 + c03d51c commit 8e67795
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from '../../../scripts/esp-controller.js';
import { getFilteredCachedResponse } from '../data-handler.js';

let PARTNERS_SERIES_ID;

/* eslint-disable no-unused-vars */
export async function onSubmit(component, props) {
if (component.closest('.fragment')?.classList.contains('hidden')) return;
Expand Down Expand Up @@ -93,17 +95,23 @@ export async function onSubmit(component, props) {
props.payload = { ...props.payload, showSponsors };
}

export async function onUpdate(_component, _props) {
// Do nothing
export async function onUpdate(component, props) {
if (!PARTNERS_SERIES_ID || PARTNERS_SERIES_ID !== props.eventDataResp.seriesId) {
const partnersGroup = component.querySelector('partner-selector-group');

PARTNERS_SERIES_ID = props.eventDataResp.seriesId;

if (PARTNERS_SERIES_ID) {
const spResp = await getSponsors(PARTNERS_SERIES_ID);
if (spResp) partnersGroup.seriesSponsors = spResp.sponsors;
}
}
}

export default async function init(component, props) {
const eventData = props.eventDataResp;
const partnersGroup = component.querySelector('partner-selector-group');

const spResp = await getSponsors(eventData.seriesId);
if (spResp) partnersGroup.seriesSponsors = spResp.sponsors;

if (eventData.sponsors) {
const partners = await Promise.all(eventData.sponsors.map(async (sponsor, index) => {
if (sponsor.sponsorType === 'Partner') {
Expand Down

0 comments on commit 8e67795

Please sign in to comment.