Tuesday, 4 April 2017

Authentication in MEANJS for new module

I have a problem in the MEAN stack to deal with the authentication.

Indeed I have created a new module called "Wallet" and here is its model:

var WalletSchema = new Schema({
created: {
type: Date,
default: Date.now
},
bitcoinAddresses: {
type: Object,
default: []
},
fringe: {
type: Array
},
user: {
type: Schema.ObjectId,
ref: 'User',
required: 'User id cannot be blank'
}
});

So it is referencing to the user Id and I'd like to load the wallet automatically with the user when my pages are loaded.

I mean everything is working correctly except that when I am refreshing my pages the User is loaded correctly but not the wallet that is causing errors then.

Is there a way to load my wallet at the same time I load my User ?

Thanks !



via Guillaume Evt

No comments:

Post a Comment