merged shortener page into admin page, refactored into modal

This commit is contained in:
itzMiney committed 2026-03-18 07:15:21 +01:00
1 parent d1d72022da
commit 6110248668
14 files changed
+363 -337

No files matched your search

+3 -21
View File
@@ -1,10 +1,9 @@
import {Component, Inject, OnInit, PLATFORM_ID} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {AuthService} from '../shared/services/auth.service';
import {ActivatedRoute, Router} from '@angular/router';
import {Router} from '@angular/router';
import {FormsModule} from '@angular/forms';
import {ViewportService} from '../shared/services/viewport.service';
import { Title } from '@angular/platform-browser';
import { take } from 'rxjs/operators';
import {ParallaxComponent} from '../shared/parallax/parallax.component';
@Component({
@@ -21,35 +20,18 @@ export class LoginComponent implements OnInit {
username = '';
password = '';
errorMessage = '';
private readonly allowedAdminRoutes = new Set([
'/admin',
'/shortener'
]);
isNarrow = false;
redirectUrl = '/admin';
constructor(
private authService: AuthService,
private router: Router,
private route: ActivatedRoute,
private deviceService: ViewportService,
private titleService: Title,
@Inject(PLATFORM_ID) private platformId: Object
) {}
ngOnInit() {
this.titleService.setTitle('Login | itzMiney')
this.isNarrow = this.deviceService.isNarrow;
this.route.queryParams.pipe(take(1)).subscribe(params => {
const raw = params['redirectUrl'];
if (typeof raw === 'string' && this.allowedAdminRoutes.has(raw)) {
this.redirectUrl = raw;
} else {
this.redirectUrl = '/admin';
}
});
}
onLogin() {
@@ -57,7 +39,7 @@ export class LoginComponent implements OnInit {
this.authService.login(this.username.trim(), this.password).subscribe({
next: () => {
void this.router.navigateByUrl(this.redirectUrl);
void this.router.navigate(['/admin']);
},
error: (err) => {
this.errorMessage =