refactor: add auth feature to encolse both login and register components

This commit is contained in:
kusowl 2026-02-19 17:25:23 +05:30
parent 32f5be8ff0
commit bfd487b05c
10 changed files with 58 additions and 3 deletions

View File

@ -1,5 +1,4 @@
import { Routes } from "@angular/router";
import { Login } from "./features/login/login";
import { Home } from "./features/home/home";
export const routes: Routes = [
@ -8,7 +7,7 @@ export const routes: Routes = [
component: Home,
},
{
path: "login",
component: Login,
path: "",
loadChildren: () => import('./features/auth/auth.routes').then(routes => routes.AuthRoutes)
},
];

View 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
}
]
}
];

View File

@ -27,6 +27,9 @@
<button type="submit" class="btn btn-black py-2">Login</button>
</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>
</section>

View File

@ -0,0 +1 @@
<p>register works!</p>

View 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();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-register',
imports: [],
templateUrl: './register.html',
styleUrl: './register.css',
})
export class Register {
}