Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { LightningElement, wire } from "lwc";
- import getAccounts from "@salesforce/apex/MyCtrl.getAccounts";
- export default class MyComponent extends LightningElement {
- @wire(getAccounts)
- accounts = [];
- }
- public with sharing class MyCtrl {
- @AuraEnabled(cacheable=true)
- public static List<Account> getAccounts() {
- try {
- return getViaCallout();
- }
- catch(Exception ex) {
- new ApplicationException().throwAuraHandled(ex);
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement