Created
September 8, 2020 23:58
-
-
Save victorabraham/fccb99f3a0ac33d18e370385ccf07fcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| 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