Commit 164e2e94 authored by jakkree kongpha's avatar jakkree kongpha

insert component

parent c11345db
This diff is collapsed.
......@@ -3,6 +3,8 @@ import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './shared/guards';
import { HomeComponent } from './home/home.component';
import { ManageanimeComponent } from './manageanime/manageanime.component';
import { CreatAnimeComponent } from './creat-anime/creat-anime.component';
const routes: Routes = [
{
......@@ -10,6 +12,17 @@ const routes: Routes = [
component: HomeComponent,
canActivate: [AuthGuard],
},
{
path: "anime",
component: ManageanimeComponent,
canActivate: [AuthGuard],
},
{
path: "create",
component: CreatAnimeComponent,
canActivate: [AuthGuard],
},
{
path: 'auth',
loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule),
......
......@@ -12,6 +12,8 @@ import { AppRoutingModule } from './app-routing.module';
import { HeaderComponent } from './header/header.component';
import { HomeComponent } from './home/home.component';
import { AuthService } from './shared/services';
import { ManageanimeComponent } from './manageanime/manageanime.component';
import { CreatAnimeComponent } from './creat-anime/creat-anime.component';
export function appInitializerFactory(authService: AuthService) {
return () => authService.checkTheUserOnTheFirstLoad();
......@@ -19,7 +21,7 @@ export function appInitializerFactory(authService: AuthService) {
@NgModule({
imports: [BrowserAnimationsModule, HttpClientModule, SharedModule, AppRoutingModule],
declarations: [AppComponent, HeaderComponent, HomeComponent],
declarations: [AppComponent, HeaderComponent, HomeComponent, ManageanimeComponent, CreatAnimeComponent],
providers: [
{
provide: HTTP_INTERCEPTORS,
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CreatAnimeComponent } from './creat-anime.component';
describe('CreatAnimeComponent', () => {
let component: CreatAnimeComponent;
let fixture: ComponentFixture<CreatAnimeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreatAnimeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CreatAnimeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-creat-anime',
templateUrl: './creat-anime.component.html',
styleUrls: ['./creat-anime.component.css']
})
export class CreatAnimeComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
......@@ -4,6 +4,8 @@
<span class="example-spacer"></span>
<a class="links side" routerLink="/auth/login" *ngIf="!user">Login</a>
<div>
<a class="links side" *ngIf="user" routerLink="/anime">Manage anime</a>
<a class="links side" *ngIf="user" routerLink="/create">Create anime</a>
<a class="links side" *ngIf="user" [matMenuTriggerFor]="menu">
<mat-icon>account_circle</mat-icon>{{ user.fullname }}
</a>
......
<p>
home works!
test build home works!
</p>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ManageanimeComponent } from './manageanime.component';
describe('ManageanimeComponent', () => {
let component: ManageanimeComponent;
let fixture: ComponentFixture<ManageanimeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ManageanimeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ManageanimeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-manageanime',
templateUrl: './manageanime.component.html',
styleUrls: ['./manageanime.component.css']
})
export class ManageanimeComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment