mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
29 lines
747 B
TypeScript
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);
|
|
}
|
|
|
|
|
|
}
|