Skip to content

Instantly share code, notes, and snippets.

@victorabraham
Created September 8, 2020 23:58
Show Gist options
  • Select an option

  • Save victorabraham/fccb99f3a0ac33d18e370385ccf07fcd to your computer and use it in GitHub Desktop.

Select an option

Save victorabraham/fccb99f3a0ac33d18e370385ccf07fcd to your computer and use it in GitHub Desktop.
<aura:component implements="flexipage:availableForAllPageTypes" controller="ContinuationDemo">
<aura:handler name="init" value="{!this}" action="{!c.handleInit}" />
<aura:attribute name="blogs" type="List" default="[]" />
<aura:iteration items="{!v.blogs}" var="blog">
<lightning:card title="{!blog.title}">
<p class="slds-p-horizontal_small">
<a href="{!blog.url}" target="_blank">{!blog.title}</a>
</p>
</lightning:card>
</aura:iteration>
</aura:component>
({
handleInit : function(component, event, helper) {
var action = component.get('c.startContinuationRequest');
action.setCallback(this, function(response) {
if (component.isValid && response.getState().toLowerCase() === 'success') {
let responseObj = JSON.parse(response.getReturnValue());
let blogs = responseObj.feed.entry.map(blogEntry => ({
"title": blogEntry.title.$t,
"url": blogEntry.link[4].href
}));
component.set('v.blogs', blogs);
} else {
console.log(response.getError()[0].message);
}
});
$A.enqueueAction(action);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment