WIP: Implement accounts
This commit is contained in:
parent
e7067744d9
commit
7c2e58cb11
6 changed files with 93 additions and 70 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -4186,11 +4186,13 @@
|
|||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -4207,7 +4209,8 @@
|
|||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
|
@ -4336,6 +4339,7 @@
|
|||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ export class AddEditAccountComponent implements OnInit, OnDestroy, Actionable {
|
|||
this.app.goBack();
|
||||
}
|
||||
|
||||
// TODO: Implement a search box with suggestions to add users
|
||||
searchUsers(username: string) {
|
||||
this.userService.getUsersByUsername(username).subscribe(users => {
|
||||
this.searchedUsers = users;
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
<p>
|
||||
new-account works!
|
||||
</p>
|
||||
<app-add-edit-account [title]="'Add Account'" [account]="account"></app-add-edit-account>
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Account } from '../account';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-account',
|
||||
|
@ -7,7 +8,11 @@ import { Component, OnInit } from '@angular/core';
|
|||
})
|
||||
export class NewAccountComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
public account: Account;
|
||||
|
||||
constructor() {
|
||||
this.account = new Account();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { UserService } from './user.service';
|
||||
import { FirestoreUserService } from './user.service.firestore';
|
||||
|
||||
describe('UserService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [UserService]
|
||||
providers: [FirestoreUserService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([UserService], (service: UserService) => {
|
||||
it('should be created', inject([FirestoreUserService], (service: UserService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
14
src/app/users/user.service.firestore.ts
Normal file
14
src/app/users/user.service.firestore.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { InjectionToken } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { User } from './user';
|
||||
import { UserService } from './user.service';
|
||||
import * as firebase from 'firebase/app';
|
||||
import 'firebase/firestore';
|
||||
|
||||
export class FirestoreUserService implements UserService {
|
||||
getUsersByUsername(username: string): Observable<User[]> {
|
||||
return Observable.create(subscriber => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue