2016-03-14 20:20:29 +08:00
|
|
|
///<reference path="../../browser.d.ts"/>
|
2016-03-13 18:28:29 +08:00
|
|
|
|
2016-03-19 16:58:27 +08:00
|
|
|
import {Component, OnInit} from 'angular2/core';
|
|
|
|
import {AuthenticationService} from "../model/authentication.service";
|
|
|
|
import {Router,Location} from "angular2/router";
|
2016-03-13 18:28:29 +08:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'gallery',
|
|
|
|
templateUrl: 'app/gallery/gallery.component.html'
|
|
|
|
})
|
2016-03-19 16:58:27 +08:00
|
|
|
export class GalleryComponent implements OnInit{
|
|
|
|
|
|
|
|
constructor(private _authService: AuthenticationService, private _router: Router, private _location:Location) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit(){
|
|
|
|
if (!this._authService.isAuthenticated()) {
|
|
|
|
this._location.replaceState('/'); // clears browser history so they can't navigate with back button
|
|
|
|
this._router.navigate(['Login']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-13 18:28:29 +08:00
|
|
|
}
|
|
|
|
|