added data sharing through siblings
"login" and "app" share user object via DataSharingServicemaster
parent
6536389eb8
commit
0b9f9cbbcb
@ -1,15 +1,15 @@
|
||||
export interface User {
|
||||
loggedIn : boolean;
|
||||
userID : number;
|
||||
username : string;
|
||||
handle : string;
|
||||
email : string;
|
||||
points : number;
|
||||
level : number;
|
||||
export class User {
|
||||
loggedIn : boolean
|
||||
userID : number
|
||||
username : string
|
||||
handle : string
|
||||
email : string
|
||||
points : number
|
||||
level : number
|
||||
|
||||
friendIDs : number[];
|
||||
groupIDs : number[];
|
||||
chatIDs : number[];
|
||||
friendIDs : number[]
|
||||
groupIDs : 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