junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.59k stars 134 forks source link

TypeError: threads_api__WEBPACK_IMPORTED_MODULE_3__.ThreadsAPI.getUserIDfromUsername is not a function #38

Closed gs18004 closed 1 year ago

gs18004 commented 1 year ago

I am using the api in React.

const onBtnClickHandler = async () => {
  const threadsAPI = new ThreadsAPI();
  console.log(threadsAPI);
  const userID = await ThreadsAPI.getUserIDfromUsername(username);
  if (!userID) {
    alert("유저 정보가 없습니다.");
    return;
  }
  const user = await threadsAPI.getUserProfile(username, userID);
  console.log(JSON.stringify(user));
};

Why does this error occur?

스크린샷 2023-07-08 오전 11 12 37
junhoyeo commented 1 year ago

Will see through, btw I don't think calling this package on the browser isn't a great idea (yet).

Manfies commented 1 year ago

Yes, same here. But I can see that you are using client side request on Next. I just moved the logic into getServerSideProps and it works as expected.

gs18004 commented 1 year ago

There was a typo. I changed ThreadsAPI to threadsAPI.