Closed tvortsa closed 5 years ago
In the framework you can use any module
The login module were used for example of how to use the framework
The Amino.login('email', 'password')
can be used for any Amino function
"any other modules" require for i must be loged in or not? Where i can get "sid" and where i can write call "any other modules" ?
Excuse me my stupidly ^^
i try somethig like this:
const AminoAPI = new Amino.AminoAPI();
AminoAPI.proccessAction(Amino.login('myemail@gmail.com', 'mypass'), function(data) {
// Here is the success handler
console.log('AMINO LOGIN SUCCESSFULL !');
const sid = AminoAPI.session_Id
aminos = Amino.getJoinedComs(sid);
aminos = aminos.coms;
aminos.map(comminity => {
console.log(`${comminity.name} | ${comminity.link}| ${comminity.id}`);
});
console.log('');
}, function(error) {
// Here is the error handler
console.log('AMINO LOGIN ERROR !');
});
Sorry for late reply And yes, it requires you to be logged in You don't need to get the SID, as it is stored as a setting inside the Amino.JS And not sure if that would work, more because getJoinedComs takes no arguments(you don't need specify the SID anywhere) You can use it like this
AminoAPI.proccessAction([Your action here], function(data) {
// process data here
], function(error) {
// process error here
});
Your code could be re-writed like this:
const AminoAPI = new Amino.AminoAPI();
// do login here
AminoAPI.proccessAction(Amino.login('myemail@gmail.com', 'mypass'), function(data) {
// Here is the success handler
console.log('AMINO LOGIN SUCCESSFULL !');
}, function(error) {
// Here is the error handler
console.log('AMINO LOGIN ERROR !');
});
// fetch communities here
AminoAPI.proccessAction(Amino.getJoinedComs(), function(data) {
data.coms.map(comminity => {
console.log(`${comminity.name} | ${comminity.link} | ${comminity.id}`);
});
}, function(error) {
throw new Error(error);
});
EDIT: had wrote the code like AminoAPI.proccessAction
was async, but infact it is sync
Thank you, unfortunately it work for Login() but not work for fetch by getJoinedComs(), and i get this error:
(node:34716) UnhandledPromiseRejectionWarning: Error: Error: SID is not specified, please use the login() method to authenticate and try again
So try it like this
const AminoAPI = new Amino.AminoAPI();
// do login here
AminoAPI.proccessAction(Amino.login('myemail@gmail.com', 'mypass'), function(data) {
// Here is the success handler
console.log('AMINO LOGIN SUCCESSFULL !', data);
// fetch communities here
AminoAPI.proccessAction(Amino.getJoinedComs(), function(data) {
data.coms.map(comminity => {
console.log(`${comminity.name} | ${comminity.link} | ${comminity.id}`);
});
}, function(error) {
throw new Error(error);
});
}, function(error) {
// Here is the error handler
console.log('AMINO LOGIN ERROR !');
});
Also check to see if the email and password is valid
Eeewhooo! Its work for me now! Thank you very mutch! ^^ (i was use : console.log('${comminity.name} | ${comminity.link} | ${comminity.id}'); but not : console.log(`${comminity.name} | ${comminity.link} | ${comminity.id}`); " ` " not " ' " )
Glad it worked! And mistakes with `` and '' i do almost always too XD
Need more examples how to use framework, more than "login" only please !
How i can use getJoinedComs(); for framework mode ?