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

insert component

parent c11345db
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,6 +3,8 @@ import { RouterModule, Routes } from '@angular/router'; ...@@ -3,6 +3,8 @@ import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './shared/guards'; import { AuthGuard } from './shared/guards';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { ManageanimeComponent } from './manageanime/manageanime.component';
import { CreatAnimeComponent } from './creat-anime/creat-anime.component';
const routes: Routes = [ const routes: Routes = [
{ {
...@@ -10,6 +12,17 @@ const routes: Routes = [ ...@@ -10,6 +12,17 @@ const routes: Routes = [
component: HomeComponent, component: HomeComponent,
canActivate: [AuthGuard], canActivate: [AuthGuard],
}, },
{
path: "anime",
component: ManageanimeComponent,
canActivate: [AuthGuard],
},
{
path: "create",
component: CreatAnimeComponent,
canActivate: [AuthGuard],
},
{ {
path: 'auth', path: 'auth',
loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule), loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule),
......
...@@ -12,6 +12,8 @@ import { AppRoutingModule } from './app-routing.module'; ...@@ -12,6 +12,8 @@ import { AppRoutingModule } from './app-routing.module';
import { HeaderComponent } from './header/header.component'; import { HeaderComponent } from './header/header.component';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { AuthService } from './shared/services'; import { AuthService } from './shared/services';
import { ManageanimeComponent } from './manageanime/manageanime.component';
import { CreatAnimeComponent } from './creat-anime/creat-anime.component';
export function appInitializerFactory(authService: AuthService) { export function appInitializerFactory(authService: AuthService) {
return () => authService.checkTheUserOnTheFirstLoad(); return () => authService.checkTheUserOnTheFirstLoad();
...@@ -19,7 +21,7 @@ export function appInitializerFactory(authService: AuthService) { ...@@ -19,7 +21,7 @@ export function appInitializerFactory(authService: AuthService) {
@NgModule({ @NgModule({
imports: [BrowserAnimationsModule, HttpClientModule, SharedModule, AppRoutingModule], imports: [BrowserAnimationsModule, HttpClientModule, SharedModule, AppRoutingModule],
declarations: [AppComponent, HeaderComponent, HomeComponent], declarations: [AppComponent, HeaderComponent, HomeComponent, ManageanimeComponent, CreatAnimeComponent],
providers: [ providers: [
{ {
provide: HTTP_INTERCEPTORS, 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 @@ ...@@ -4,6 +4,8 @@
<span class="example-spacer"></span> <span class="example-spacer"></span>
<a class="links side" routerLink="/auth/login" *ngIf="!user">Login</a> <a class="links side" routerLink="/auth/login" *ngIf="!user">Login</a>
<div> <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"> <a class="links side" *ngIf="user" [matMenuTriggerFor]="menu">
<mat-icon>account_circle</mat-icon>{{ user.fullname }} <mat-icon>account_circle</mat-icon>{{ user.fullname }}
</a> </a>
......
<p> <p>
home works! test build home works!
</p> </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