Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function insertUser(
- address userAddress,
- bytes32 userEmail,
- string userName)
- public
- returns(uint index) {
- if (isUser(userAddress)) revert();
- userObjects[userAddress].userEmail = userEmail;
- userObjects[userAddress].userName = userName;
- userObjects[userAddress].index = userIndex.push(userAddress)-1;
- LogNewUser(
- userAddress,
- userObjects[userAddress].index,
- userEmail,
- userName);
- return userIndex.length-1;
- }
- register(address: string): Observable<any> {
- return Observable.create(observer => {
- this.auth.deployed().then(instance => {
- console.log('add=>', address, 'insertion')
- return instance.insertUser(address, 'something', 'something');
- })
- .then(numberOfUsers => {
- observer.next();
- })
- .catch(e => {
- console.log(e);
- observer.error(e);
- });
- });
- }
- this.web3Service.getAccounts().subscribe(accs => {
- this.account = accs[0];
- this._ngZone.run(() =>
- );
- }, err => alert(err));
- this.authService.register(this.account).subscribe(data => {
- console.log(data);
- });
Add Comment
Please, Sign In to add comment