Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"echarts": "^5.5.0",
"fast-xml-parser": "^5.2.5",
"jsonpath": "^1.1.1",
"ngx-cookie-service": "^19.1.2",
"ngx-echarts": "^19.0.0",
"rxjs": "^7.8.1",
"stacktrace-js": "^2.0.2",
Expand Down
9 changes: 3 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {TranslateService} from '@ngx-translate/core';
import {Observable, Subscription} from 'rxjs';
import {map} from 'rxjs/operators';

import {AuthService} from '@app/core/auth/auth.service';
import {LoginService} from '@app/core/auth/login.service';
import {Principal} from '@app/core/auth/principal.service';
import {ErrorTrackingService} from '@app/services/error-tracking.service';
Expand Down Expand Up @@ -40,7 +39,6 @@ export class AppComponent implements OnInit, OnDestroy {
/** Translate service */public trans: TranslateService,
/** Identity service */public principal: Principal,
/** Login service */public loginService: LoginService,
/** Auth service */public authService: AuthService,
private readonly loggerService: LoggerService,
private readonly appStateService: AppStateService,
private readonly errorTrackingService: ErrorTrackingService
Expand Down Expand Up @@ -73,13 +71,13 @@ export class AppComponent implements OnInit, OnDestroy {

// Listen for browser language changes
window.addEventListener('languagechange', () => {
if (!this.authService.getToken()) {
if (!this.principal.isAuthenticated()) {
this.setInitialLanguage();
}
});

// Load user account if authenticated
if (this.authService.getToken()) {
if (this.principal.isAuthenticated()) {
this.principal.identity().then((account) => {
this.currentAccount = account;
});
Expand Down Expand Up @@ -117,7 +115,7 @@ export class AppComponent implements OnInit, OnDestroy {
if (storedLang && config.languagesToUse?.find(lang => lang.shortname === storedLang)) {
this.translate.use(storedLang);
this.translate.setDefaultLang(storedLang);
} else if (!this.authService.getToken()) {
} else if (!this.principal.isAuthenticated()) {
// Use browser language for non-authenticated users
const navigatorLang = window.navigator.language.toLowerCase();
const baseLang = navigatorLang.replace(/-[A-Z]+$/, '');
Expand Down Expand Up @@ -147,4 +145,3 @@ export class AppComponent implements OnInit, OnDestroy {
return this.principal.isAuthenticated();
}
}

13 changes: 3 additions & 10 deletions src/app/components/base-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ export class BaseFormComponent<T extends Resource> implements OnInit, AfterViewI
*/
async fetchData(): Promise<void> {
try {
// Prevent unauthorized backend calls if the user is logged out
const token = sessionStorage.getItem('authenticationToken');
if (!token) {
this.loggerService.debug('fetchData skipped: no auth token');
this.dataLoaded = false;
return;
}
await this.processRouteParams();
await this.preFetchData();
if (!this.isNewOrDuplicated()) {
Expand Down Expand Up @@ -382,7 +375,7 @@ export class BaseFormComponent<T extends Resource> implements OnInit, AfterViewI
*
* @returns {void}
*/

postFetchData(): void {
}

Expand Down Expand Up @@ -572,7 +565,7 @@ export class BaseFormComponent<T extends Resource> implements OnInit, AfterViewI
*
* @returns {Promise<number>} Promise that resolves with the ID of the created entity
*/

createEntity(): Promise<number> {
return Promise.resolve(null)
}
Expand All @@ -594,7 +587,7 @@ export class BaseFormComponent<T extends Resource> implements OnInit, AfterViewI
* @param {boolean} _isDuplicated - Whether the operation is a duplication
* @returns {Promise<void>} Promise that resolves when related data is updated
*/

updateDataRelated(_isDuplicated: boolean): Promise<void> {
return Promise.resolve()
}
Expand Down
Loading