rename admin to dashboard
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
<h1 class="text-2xl">My Blog</h1>
|
<h1 class="text-2xl">My Blog</h1>
|
||||||
</a>
|
</a>
|
||||||
<nav class="flex gap-5">
|
<nav class="flex gap-5">
|
||||||
<a routerLink="/dashboard" *ngIf="loggedIn()">admin</a>
|
<a routerLink="/dashboard" *ngIf="loggedIn()">posts</a>
|
||||||
<button *ngIf="!loggedIn()" (click)="toggleLogin()">login</button>
|
<button *ngIf="!loggedIn()" (click)="toggleLogin()">login</button>
|
||||||
<button *ngIf="loggedIn()" (click)="logOut()">logout</button>
|
<button *ngIf="loggedIn()" (click)="logOut()">logout</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { HomeComponent } from './routes/home/home.component';
|
import { HomeComponent } from './routes/home/home.component';
|
||||||
import { PostComponent } from './routes/post/post.component';
|
import { PostComponent } from './routes/post/post.component';
|
||||||
import { AdminComponent } from './routes/admin/admin.component';
|
import { DashboardComponent } from './routes/dashboard/dashboard.component';
|
||||||
import { LoggedInGuard } from './shared/guards/logged-in.guard';
|
import { LoggedInGuard } from './shared/guards/logged-in.guard';
|
||||||
import { PostEditorComponent } from './components/post-editor/post-editor.component';
|
import { PostEditorComponent } from './components/post-editor/post-editor.component';
|
||||||
import { CreatePostComponent } from './routes/post/create-post/create-post.component';
|
import { CreatePostComponent } from './routes/post/create-post/create-post.component';
|
||||||
@ -20,6 +20,10 @@ export const routes: Routes = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ path: 'admin', component: AdminComponent, canActivate: [LoggedInGuard] },
|
{
|
||||||
|
path: 'dashboard',
|
||||||
|
component: DashboardComponent,
|
||||||
|
canActivate: [LoggedInGuard],
|
||||||
|
},
|
||||||
{ path: 'tst', component: PostEditorComponent },
|
{ path: 'tst', component: PostEditorComponent },
|
||||||
];
|
];
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { AdminComponent } from './admin.component';
|
import { DashboardComponent } from './dashboard.component';
|
||||||
|
|
||||||
describe('AdminComponent', () => {
|
describe('AdminComponent', () => {
|
||||||
let component: AdminComponent;
|
let component: DashboardComponent;
|
||||||
let fixture: ComponentFixture<AdminComponent>;
|
let fixture: ComponentFixture<DashboardComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [AdminComponent]
|
imports: [DashboardComponent],
|
||||||
})
|
}).compileComponents();
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(AdminComponent);
|
fixture = TestBed.createComponent(DashboardComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
@ -8,9 +8,9 @@ import { RouterLink, RouterOutlet } from '@angular/router';
|
|||||||
selector: 'app-admin',
|
selector: 'app-admin',
|
||||||
imports: [NgFor, RouterLink],
|
imports: [NgFor, RouterLink],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
templateUrl: './admin.component.html',
|
templateUrl: './dashboard.component.html',
|
||||||
})
|
})
|
||||||
export class AdminComponent {
|
export class DashboardComponent {
|
||||||
private postsService = inject(PostsService);
|
private postsService = inject(PostsService);
|
||||||
posts = this.postsService.getPosts();
|
posts = this.postsService.getPosts();
|
||||||
|
|
@ -5,6 +5,9 @@ export interface User {
|
|||||||
export interface LoginResponse {
|
export interface LoginResponse {
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
export interface Token {
|
export interface Claims {
|
||||||
exp: number;
|
exp: number;
|
||||||
|
uid: number;
|
||||||
|
rl: string;
|
||||||
|
sub: string;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user