Playing with 1.3 and trying to figure out what I use for all my imports. NPM packages are easy to figure out, but what do I do for Meteor methods?
For example, in 1.2 I use: Accounts.onCreateUser(function (options, user){}
So in 1.3 I need to import Accounts, but from where? import Accounts from 'meteor/meteor';// doesn’t work import accountsServer from 'meteor/meteor'; // Docs actually say this method is accountsServer.onCreateUser, but doesn’t work. import Accounts from 'meteor/accounts-base'; // stabbing in the dark
You can still use the global variables just like before! But if you want, you can switch to using imports. I’m going to go through and document how to import all of the functions soon, it’s not ready yet since it is a beta after all.
Oh cool. That does work. I assumed that if I was using imports at all, everything had to be imported. It is nice knowing where everything is coming from — so I look forward to the updated documentation!
@sashko So now that I cleared out some other errors and I run this function I actually get this error: Uncaught TypeError: Accounts.onCreateUser is not a function meteorInstall.lib.createUser.js @ createUser.js:3 fileEvaluate @ install.js:183 require @ install.js:75 (anonymous function) @ app.js?hash=fb6c5809bb22af516adcaf9bbad2e667e78f4001:94944
Yeah, works fine in 1.2. I’m playing around in porting to 1.3 (using beta4), though. I do have accounts-password package installed and I can create users, login, logout.
In my 1.2 app, I just have a CreateUser.js file in /lib that when a new user is created, pulls profile info from 3rd parties registers (facebook,google) and sends a welcome email. In this repo, /lib/createUser.js is super dumbed down.
@reoh Well that was the simple obvious solution that I overlooked. Move it to server folder. Just tried out the Meteor Modules-todo-react sample app plugged Accounts.onCreateUser into it and worked fine. Thanks for keeping engaged until I worked it out!