This commit is contained in:
crusader 2018-03-12 17:38:03 +09:00
parent eff89ec032
commit a9eb6863f1
3 changed files with 8 additions and 2 deletions

View File

@ -1,8 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { AuthGuard } from './commons/guard/auth.guard';
const routes: Routes = [ const routes: Routes = [
{ path: '', loadChildren: './pages/pages.module#PagesModule' }, { path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] },
{ path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' },
{ path: 'errors', loadChildren: './pages/errors/errors-page.module#ErrorsPageModule' }, { path: 'errors', loadChildren: './pages/errors/errors-page.module#ErrorsPageModule' },
// { path: '**', redirectTo: 'errors/404' } // { path: '**', redirectTo: 'errors/404' }

View File

@ -7,6 +7,8 @@ import { HttpClientModule } from '@angular/common/http';
import { CookieService } from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service';
import { MemberModule } from 'packages/member/member.module';
import { RPCClient } from 'packages/core/rpc/client/RPCClient'; import { RPCClient } from 'packages/core/rpc/client/RPCClient';
import { RPCClientCodec } from 'packages/core/rpc/protocol/RPCClientCodec'; import { RPCClientCodec } from 'packages/core/rpc/protocol/RPCClientCodec';
import { RPCClientJSONCodec } from 'packages/core/rpc/protocol/json/RPCClientJSONCodec'; import { RPCClientJSONCodec } from 'packages/core/rpc/protocol/json/RPCClientJSONCodec';
@ -29,6 +31,7 @@ import { AppComponent } from './app.component';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { RPCService } from './commons/service/rpc.service'; import { RPCService } from './commons/service/rpc.service';
import { RESTService } from './commons/service/rest.service'; import { RESTService } from './commons/service/rest.service';
import { AuthGuard } from './commons/guard/auth.guard';
@NgModule({ @NgModule({
@ -41,6 +44,7 @@ import { RESTService } from './commons/service/rest.service';
MaterialModule, MaterialModule,
CovalentModule, CovalentModule,
HttpClientModule, HttpClientModule,
MemberModule,
], ],
providers: [ providers: [
{provide: 'REST_BASE_URL', useValue: environment.restBaseURL}, {provide: 'REST_BASE_URL', useValue: environment.restBaseURL},
@ -59,6 +63,7 @@ import { RESTService } from './commons/service/rest.service';
provide: RPCClient, useClass: RPCService provide: RPCClient, useClass: RPCService
}, },
CookieService, CookieService,
AuthGuard,
], ],
declarations: [ declarations: [
AppComponent, AppComponent,

View File

@ -58,7 +58,7 @@ export class Effects {
signinRedirect$ = this.actions$ signinRedirect$ = this.actions$
.ofType(ActionType.SigninRedirect, ActionType.Signout) .ofType(ActionType.SigninRedirect, ActionType.Signout)
.do(authed => { .do(authed => {
this.router.navigate(['/login']); this.router.navigate(['/auth/signin']);
}); });
} }