Skip to content

Instantly share code, notes, and snippets.

@nesbtesh
Created July 11, 2022 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesbtesh/39850b1dbbca8b82ea4f67c2653aff43 to your computer and use it in GitHub Desktop.
Save nesbtesh/39850b1dbbca8b82ea4f67c2653aff43 to your computer and use it in GitHub Desktop.
import { Accounts } from "meteor/accounts-base";
class blue {
call(name, params) {
return new Promise((resolve, reject) => {
Meteor.call(name, params, (err, resp) => {
if (err) reject(err);
else resolve(resp);
});
});
}
logout() {
return Meteor.logout();
}
login({ email, callback, password }) {
return Accounts.callLoginMethod({
methodArguments: [
{
user: { email },
twoFactorPassword: Accounts._hashPassword(password),
},
],
userCallback: callback,
});
}
upsertUser({ profile, email, password, _id }) {
return this.call("users.upsert", {
profile,
email,
password,
_id,
});
}
users({ limit, page, searchQuery }) {
return this.call("users.get", {
limit,
page,
searchQuery,
});
}
}
// inialize and export
const Bluelagoon = new blue();
export default Bluelagoon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment