이타인클럽입니다.
주말은 앱 개발하는 날입니다.
애들도 잠자기 전에 이렇게 얘기합니다.
"You need to make an app or I will kick your bottom one million times"
근데 너무 피곤하네요.
멀티 계정 로그인커뮤니티 선택
저는 스팀잇에서 커뮤니티 바로 가기가 있으면 좋겠다 싶어서 이 기능을 추가하고 있습니다.
기존의 스팀잇 라이브러리에는 이 기능이 없더라구요. 커뮤니티 기능이 새로 추가되어 그런가 봅니다.
스팀잇 사이트를 분석하여 방법을 찾아냈습니다.
// get community list of a user
export const fetchCommunityList = async (
username: string,
): Promise<string[]> => {
try {
const data = {
id: 1,
jsonrpc: '2.0',
method: 'bridge.list_all_subscriptions',
params: {account: username},
};
let communities: string[] = [];
await fetch(MAINNET_OFFICIAL, {
method: 'POST',
body: JSON.stringify(data),
})
.then((res) => res.json())
.then((res) => {
res.result.forEach((item) => communities.push(item[1]));
});
// check exists
if (communities.length == 0) {
return null;
}
console.log('[fetchCommunityList res', communities);
return communities;
} catch (error) {
console.log('failed to fetch community list', error);
return null;
}
};
구조가 비교적 잘 잡혀서 개발은 속도가 붙고 있네요.
- Functional Component 사용
- useContext 사용
- Container/View 분리
- Typescript
타입스크립트로 기존 코드 리팩토링하는게 좀 오래걸리지만, 대신에 오류를 바로 바로 알려줘서 더욱 안정적으로 개발되고 있습니다.
추석연휴가 끝날 때까지 어느 정도 모습이 갖춰지도록 해볼께요.
추석 잘 보내시고, 많은 응원 부탁드립니다!!!
수고 많으십니다
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
응원 정말 고맙습니다!
오늘도 달립니다!!!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit