Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
980 B
1
Indexable
 handleFilter = (item:any) => {
    // console.log('handleTrending Filter' , e)
    this.setState({ filterType: item })
    this._fetchSongsFilterTrendingApi(item)
  }

  _fetchSongsFilterTrendingApi = async (item: any) => {
    this.setState({ loader: true })

    const token = await getStorageData('USER_TOKEN')
    const header = {
      "Content-Type": "application/json",
      token
    };
    const requestMessage = new Message(getName(MessageEnum.RestAPIRequestMessage));
    this.apiSongsTrendingPost = requestMessage.messageId;
    requestMessage.addData(
      getName(MessageEnum.RestAPIResponceEndPointMessage),
      configJSON.trendingApiEndPoint +`?filter_by=${item}`
    );
    requestMessage.addData(
      getName(MessageEnum.RestAPIRequestHeaderMessage),
      JSON.stringify(header)
    );
    requestMessage.addData(getName(MessageEnum.RestAPIRequestMethodMessage), configJSON.httpGetType);
    runEngine.sendMessage(requestMessage.id, requestMessage);
  }