From 16280a1d04bfbd77cb62064036b40236dd45cdac Mon Sep 17 00:00:00 2001 From: Zuhdan Ubay Date: Fri, 22 May 2020 12:10:03 +0700 Subject: [PATCH] add auth --- src/app/app-routing.module.ts | 30 +++----- src/app/app.module.ts | 18 +++++ src/app/auth/auth.component.ts | 24 ------- src/app/auth/auth.module.ts | 57 --------------- ...ting.module.ts => login-routing.module.ts} | 32 +++------ src/app/auth/{login => }/login.component.html | 69 +++++++------------ src/app/auth/{login => }/login.component.ts | 1 + src/app/auth/login.module.ts | 35 ++++++++++ 8 files changed, 98 insertions(+), 168 deletions(-) delete mode 100644 src/app/auth/auth.component.ts delete mode 100644 src/app/auth/auth.module.ts rename src/app/auth/{auth-routing.module.ts => login-routing.module.ts} (50%) rename src/app/auth/{login => }/login.component.html (56%) rename src/app/auth/{login => }/login.component.ts (99%) create mode 100644 src/app/auth/login.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 24295f0f..02bd9e07 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,35 +1,21 @@ import { ExtraOptions, RouterModule, Routes } from '@angular/router'; import { NgModule } from '@angular/core'; -import { - NbAuthComponent, - NbLoginComponent, - NbLogoutComponent, - NbRegisterComponent, - NbRequestPasswordComponent, - NbResetPasswordComponent, -} from '@nebular/auth'; -import { AppComponent } from './app.component'; export const routes: Routes = [ - // { - // path: 'pages', - // loadChildren: () => import('./pages/pages.module') - // .then(m => m.PagesModule), - // }, + { + path: 'pages', + loadChildren: () => import('./pages/pages.module') + .then(m => m.PagesModule), + }, { path: 'auth', - loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule), + loadChildren: () => import('./auth/login.module').then(m => m.AuthModule), }, - // { path: '', redirectTo: 'auth', pathMatch: 'full' }, - // { path: '**', redirectTo: 'auth' }, + { path: '', redirectTo: 'auth', pathMatch: 'full' }, + { path: '**', redirectTo: 'auth' }, ]; -// const config: ExtraOptions = { -// useHash: false, -// }; - @NgModule({ - // imports: [RouterModule.forRoot(routes, config)], imports: [RouterModule.forRoot(routes)], exports: [RouterModule], }) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3ca74c34..1b40058a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -48,6 +48,24 @@ import { NbAuthModule, NbDummyAuthStrategy } from '@nebular/auth'; }), CoreModule.forRoot(), ThemeModule.forRoot(), + + CommonModule, + HttpClientModule, + NbLayoutModule, + NbCardModule, + NbButtonModule, + AppRoutingModule, + + NbAuthModule.forRoot({ + strategies: [ + NbDummyAuthStrategy.setup({ + name: 'email', + + alwaysFail: true, + delay: 1000, + }), + ], + }), ], bootstrap: [AppComponent], }) diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts deleted file mode 100644 index 53bc3ce8..00000000 --- a/src/app/auth/auth.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -import { Component } from '@angular/core'; - -@Component({ - selector: 'ngx-app', - template: ` - - - - - Login - - - - - `, -}) -export class AuthComponent { -} \ No newline at end of file diff --git a/src/app/auth/auth.module.ts b/src/app/auth/auth.module.ts deleted file mode 100644 index ae6df5d9..00000000 --- a/src/app/auth/auth.module.ts +++ /dev/null @@ -1,57 +0,0 @@ - -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; - -import { AuthRoutingModule } from './auth-routing.module'; -import { NbAuthModule, NbDummyAuthStrategy } from '@nebular/auth'; -import { NbAlertModule, NbButtonModule, NbCheckboxModule, NbInputModule, NbLayoutModule, NbCardModule } from '@nebular/theme'; - -import { LoginComponent } from './login/login.component'; -import { HttpClientModule } from '@angular/common/http'; -import { AppRoutingModule } from '../app-routing.module'; -import { AuthComponent } from './auth.component'; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - NbAlertModule, - NbInputModule, - NbButtonModule, - NbCheckboxModule, - AuthRoutingModule, - - NbAuthModule, - - CommonModule, - HttpClientModule, - NbLayoutModule, - NbCardModule, - NbButtonModule, - AppRoutingModule, - - NbAuthModule.forRoot({ - strategies: [ - NbDummyAuthStrategy.setup({ - name: 'email', - - alwaysFail: true, - delay: 1000, - }), - ], - }), - ], - declarations: [ - LoginComponent, - AuthComponent, - ], -}) -export class AuthModule { -} \ No newline at end of file diff --git a/src/app/auth/auth-routing.module.ts b/src/app/auth/login-routing.module.ts similarity index 50% rename from src/app/auth/auth-routing.module.ts rename to src/app/auth/login-routing.module.ts index fbead63a..de6d2762 100644 --- a/src/app/auth/auth-routing.module.ts +++ b/src/app/auth/login-routing.module.ts @@ -1,4 +1,3 @@ - /** * @license * Copyright Akveo. All Rights Reserved. @@ -9,35 +8,24 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { NbAuthComponent } from '@nebular/auth'; -import { LoginComponent } from './login/login.component'; -import { AuthComponent } from './auth.component'; +import { LoginComponent } from './login.component'; export const routes: Routes = [ - { path: '', - component: AuthComponent, + component: NbAuthComponent, children: [ - { - path: 'login', - component: LoginComponent, - }, - ], + { + path: '', + component: LoginComponent, + }, + ], }, { - path: 'auth', - loadChildren: () => import('./auth.module').then(m => m.AuthModule), + path: 'pages', + loadChildren: () => import('../pages/pages.module') + .then(m => m.PagesModule), }, -// { -// path: '', -// component: NbAuthComponent, -// children: [ -// { -// path: 'login', -// component: LoginComponent, -// }, -// ], -// }, ]; @NgModule({ diff --git a/src/app/auth/login/login.component.html b/src/app/auth/login.component.html similarity index 56% rename from src/app/auth/login/login.component.html rename to src/app/auth/login.component.html index ef51957f..6d14f97d 100644 --- a/src/app/auth/login/login.component.html +++ b/src/app/auth/login.component.html @@ -14,47 +14,32 @@ -
+ +
- - + +

- Email is required! -

-

- Email should be the real one! + NIK is required!

+
- +

Password is required! @@ -68,26 +53,24 @@

-
+ + - -