import { Injectable } from '@angular/core';
import { observable, Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';

@Injectable({
  providedIn: 'root'
})
export class SubjectService {
  private loginState = new BehaviorSubject<any>(null);
  private DataState = new BehaviorSubject<any>(null);
  private TabState = new BehaviorSubject<any>(null);

  sendLoginData(state: any) {
    this.loginState.next(state);
  }

  getLoginData(): Observable<any> {
    return this.loginState.asObservable();
  }

  sendUserData(state: any) {
    this.DataState.next(state);
  }

  getUserData(): Observable<any> {
    return this.DataState.asObservable();
  }

  setTabData(state: any) {
    return this.TabState.next(state);
  }

  getTabData(): Observable<any> {
    return this.TabState.asObservable();
  }
}
