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