Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import { LightningElement, wire } from "lwc";
  2.  
  3. import getAccounts from "@salesforce/apex/MyCtrl.getAccounts";
  4.  
  5. export default class MyComponent extends LightningElement {
  6.  
  7. @wire(getAccounts)
  8. accounts = [];
  9. }
  10.  
  11. public with sharing class MyCtrl {
  12.  
  13. @AuraEnabled(cacheable=true)
  14. public static List<Account> getAccounts() {
  15. try {
  16. return getViaCallout();
  17. }
  18. catch(Exception ex) {
  19. new ApplicationException().throwAuraHandled(ex);
  20. }
  21.  
  22. return null;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement