1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/model/authentication.service.ts
2016-03-14 13:20:29 +01:00

29 lines
747 B
TypeScript

///<reference path="../../browser.d.ts"/>
import * as io from 'socket.io-client';
import {Injectable} from 'angular2/core';
import {OnInit} from "angular2/core";
import {NetworkService} from "./network.service";
import {User} from "../../../common/entities/User";
import {Event} from "../../../common/event/Event";
@Injectable()
export class AuthenticationService{
private _user:User;
public OnAuthenticated:Event<User>;
constructor(private _networkService: NetworkService){
this.OnAuthenticated = new Event();
this._networkService.OnAuthenticated.on(this.onAuthenticated);
}
private onAuthenticated = (user:User) => {
this._user=user;
this.OnAuthenticated.trigger(this._user);
}
}