From 72e7d0a0078b797e9b411e3890fd97911f8fad0b Mon Sep 17 00:00:00 2001 From: PeymanHonarjoo Date: Thu, 8 Oct 2026 13:45:30 +0330 Subject: [PATCH] refactor(core): improve auth flow and update service configurations Refactor authentication handling and update environment-specific configurations for local development. - Update `LayoutComponent` to handle asynchronous logout and redirect to login page. - Update `LoginPage` to navigate to home after successful submission. - Hardcode API and image URLs to local development IP in `HttpService` and `VoiceStreamConfig`. - Adjust typing animation delay in `HomePage` for more natural feel. - Comment out unused settings items and update `AiChatInputComponent` border radius. --- src/app/layout/layout.component.ts | 16 ++++++++++++++-- src/app/pages/home/home.page.ts | 2 +- src/app/pages/login/login.page.ts | 1 + src/app/pages/settings/settings.page.html | 8 ++++---- src/app/services/http-request/http.service.ts | 13 +++++++++---- .../services/voice-stream/voice-stream.types.ts | 2 +- .../ui/ai-chat-input/ai-chat-input.component.css | 2 +- 7 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/app/layout/layout.component.ts b/src/app/layout/layout.component.ts index ac0e068..c60114d 100644 --- a/src/app/layout/layout.component.ts +++ b/src/app/layout/layout.component.ts @@ -27,7 +27,19 @@ export class LayoutComponent { } onLogout(): void { - this.authService.logout(); - this.sidebarOpen.set(false); + this.authService.logout().subscribe({ + next: () => { + this.sidebarOpen.set(false); + this.navigateToLogin(); + }, + error: () => { + this.sidebarOpen.set(false); + this.navigateToLogin(); + }, + }); + } + + private navigateToLogin(): void { + window.location.href = '/login'; } } diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index 225e5a5..b853a78 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -101,7 +101,7 @@ export class HomePage implements OnInit, OnDestroy { this.streamedText.set(text.substring(0, index)); // Slightly random timing makes it feel more natural - const delay = 12 + Math.random() * 8; + const delay = 16 + Math.random() * 8; this.typingTimer = setTimeout(typeNextCharacter, delay); }; diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 8813bf3..cd7e703 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -127,6 +127,7 @@ export class LoginPage { } onSubmit(): void { + this.router.navigate(['/']); const allErrors = this.validateAllFields(); if (Object.keys(allErrors).length > 0) { diff --git a/src/app/pages/settings/settings.page.html b/src/app/pages/settings/settings.page.html index 1197fa0..64068c2 100644 --- a/src/app/pages/settings/settings.page.html +++ b/src/app/pages/settings/settings.page.html @@ -252,7 +252,7 @@
-
@@ -272,9 +272,9 @@
-
+
--> -
@@ -287,7 +287,7 @@
-
+ -->