+ Start a Discussion
Shavi DabgotraShavi Dabgotra 

How to call a wire method in OnClick of another button

Hi everyone!
Can someone tell me How can we call a wire method in another method in lightning web component?
As I want to call below method:
@wire(getAllFolder,{currentPageid:'$recordId'})
  wiredCases(value){  
    this.wiredActivities = value;
    const { data, error } = value;
    if(data){
      let dataEditing = JSON.parse(JSON.stringify(data));
          
    }else if(error){
    this.error = error;
    }
  }
In another method as: 
handleNavigation2(){
}

How to call in this?
Thank you in advance!

CharuDuttCharuDutt
Hii Shavi Dabgotra
Try The Following Code
<lightning-button access-key={item.id} onclick={handleNavigation2}></lightning-button>

handleNavigation2(event){
let id = event.target.accessKey;
getAllFolder({
      currentPageid: id 
    })
      .then((result) => {
           let dataEditing = JSON.parse(JSON.stringify(result));
      })
      .catch((error) => {
          this.error = error;
      });
  }
}
Please Mark it as Best Answer If It Helps
Thank You!