added data sharing through siblings
"login" and "app" share user object via DataSharingServicemaster
parent
6536389eb8
commit
0b9f9cbbcb
@ -1,15 +1,15 @@
|
|||||||
export interface User {
|
export class User {
|
||||||
loggedIn : boolean;
|
loggedIn : boolean
|
||||||
userID : number;
|
userID : number
|
||||||
username : string;
|
username : string
|
||||||
handle : string;
|
handle : string
|
||||||
email : string;
|
email : string
|
||||||
points : number;
|
points : number
|
||||||
level : number;
|
level : number
|
||||||
|
|
||||||
friendIDs : number[];
|
friendIDs : number[]
|
||||||
groupIDs : number[];
|
groupIDs : number[]
|
||||||
chatIDs : number[];
|
chatIDs : number[]
|
||||||
|
|
||||||
requestIDs : number[];
|
requestIDs : number[]
|
||||||
}
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DatasharingService } from './datasharing.service';
|
||||||
|
|
||||||
|
describe('DatasharingService', () => {
|
||||||
|
beforeEach(() => TestBed.configureTestingModule({}));
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
const service: DatasharingService = TestBed.get(DatasharingService);
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
import { User } from '../models/user';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class DatasharingService {
|
||||||
|
|
||||||
|
private userInfoSource = new BehaviorSubject<User>(new User())
|
||||||
|
currentUserInfo = this.userInfoSource.asObservable();
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
changeUserInfo(pUserInfo: User) {
|
||||||
|
this.userInfoSource.next(pUserInfo)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue