Let's consider the following:
struct SkillStruct{
bytes32 skillName;
uint index;
}
struct UserStruct {
bytes32 userEmail;
bytes32 userFirstname;
bytes32 userLastname;
uint index;
uint amount; //amount of ECR token
address[] userSkills;
}
mapping(address => UserStruct) private userStructs;
address[] private userIndex;
mapping(address => SkillStruct) private skillStructs;
address[] private skillIndex;
Is there a way to display all my users and theirs skills in an HTML list in my Dapp ? How can I process to get all my users ? What's the best for doing that ?
I tried to get inspired by https://www.cryptokitties.co/ source code, but all I found is a function to return kitten one by one but not all of them.
The only clue I see right now is to call a function to get users.length and then in an asynchronous loop call the getUser() function as many times as there are users. And then maybe use caching or localstorage to store them into the browser.
Is there a better way ??
Thanks u all