refactor: add auth feature to encolse both login and register components
This commit is contained in:
parent
32f5be8ff0
commit
bfd487b05c
@ -1,5 +1,4 @@
|
|||||||
import { Routes } from "@angular/router";
|
import { Routes } from "@angular/router";
|
||||||
import { Login } from "./features/login/login";
|
|
||||||
import { Home } from "./features/home/home";
|
import { Home } from "./features/home/home";
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
@ -8,7 +7,7 @@ export const routes: Routes = [
|
|||||||
component: Home,
|
component: Home,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "login",
|
path: "",
|
||||||
component: Login,
|
loadChildren: () => import('./features/auth/auth.routes').then(routes => routes.AuthRoutes)
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
18
src/app/features/auth/auth.routes.ts
Normal file
18
src/app/features/auth/auth.routes.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { Routes } from "@angular/router";
|
||||||
|
import { Login } from "./components/login/login";
|
||||||
|
import { Register } from "./components/register/register";
|
||||||
|
|
||||||
|
export const AuthRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'login', component: Login,
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
path: "register", component: Register
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
@ -27,6 +27,9 @@
|
|||||||
|
|
||||||
<button type="submit" class="btn btn-black py-2">Login</button>
|
<button type="submit" class="btn btn-black py-2">Login</button>
|
||||||
</form>
|
</form>
|
||||||
|
<a href="" class="text-xs text-gray-800 text-center w-full block hover:text-teal-600"
|
||||||
|
>New User ? Sign Up</a
|
||||||
|
>
|
||||||
</article>
|
</article>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
1
src/app/features/auth/components/register/register.html
Normal file
1
src/app/features/auth/components/register/register.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p>register works!</p>
|
||||||
23
src/app/features/auth/components/register/register.spec.ts
Normal file
23
src/app/features/auth/components/register/register.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Register } from './register';
|
||||||
|
|
||||||
|
describe('Register', () => {
|
||||||
|
let component: Register;
|
||||||
|
let fixture: ComponentFixture<Register>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Register]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Register);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
await fixture.whenStable();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
11
src/app/features/auth/components/register/register.ts
Normal file
11
src/app/features/auth/components/register/register.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-register',
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './register.html',
|
||||||
|
styleUrl: './register.css',
|
||||||
|
})
|
||||||
|
export class Register {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user