Fixing some small registration and login isues
This commit is contained in:
parent
5aa2feff7b
commit
9ed5089508
8 changed files with 66 additions and 44 deletions
|
|
@ -39,6 +39,6 @@ Template.login.events({
|
|||
},
|
||||
'click #reg' (event) {
|
||||
event.preventDefault();
|
||||
FlowRouter.go('/reg');
|
||||
Session.set("loginOrReg", "reg");
|
||||
},
|
||||
});
|
||||
|
|
@ -96,12 +96,17 @@ Template.reg.events({
|
|||
let userId = Meteor.userId();
|
||||
// console.log("User ID: " + userId);
|
||||
const addRole = async() => {
|
||||
let result = await Meteor.callAsync("addToRole", "user");
|
||||
if (!result) {
|
||||
console.log(" ERROR: ROLES - Error adding user to role: ");
|
||||
} else {
|
||||
// console.log("User should be added to role - teacher.");
|
||||
FlowRouter.go('/dashboard');
|
||||
try {
|
||||
let result = await Meteor.callAsync("addToRole", "user");
|
||||
if (!result) {
|
||||
throw Meteor.error("Failed to create role.", error.message);
|
||||
} else {
|
||||
console.log("Result is: " + result)
|
||||
FlowRouter.go('/home');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(" ERROR: ROLES - Error adding user to role: ", error.message);
|
||||
}
|
||||
}
|
||||
addRole();
|
||||
|
|
@ -132,6 +137,6 @@ Template.reg.events({
|
|||
},
|
||||
'click #login' (event) {
|
||||
event.preventDefault();
|
||||
FlowRouter.go('/login');
|
||||
Session.set("loginOrReg", "login");
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue