diff --git a/apps/octra/src/app/core/component/navbar/navbar.component.html b/apps/octra/src/app/core/component/navbar/navbar.component.html index 06b470d21..818b476df 100644 --- a/apps/octra/src/app/core/component/navbar/navbar.component.html +++ b/apps/octra/src/app/core/component/navbar/navbar.component.html @@ -320,7 +320,7 @@ {{ 'g.name' | transloco }}: - {{ audio.audioManager!.resource.info?.fullname }} + {{ audio.audioManager!.resource.info.fullname }} @@ -346,7 +346,7 @@ {{ - audio.audioManager!.resource!.info?.sampleRate + audio.audioManager!.resource!.info.sampleRate }} @@ -357,7 +357,7 @@ {{ - audio.audioManager!.resource!.info?.bitrate + audio.audioManager!.resource!.info.bitrate }} Bit/s diff --git a/apps/octra/src/app/core/store/idb/idb-effects.service.ts b/apps/octra/src/app/core/store/idb/idb-effects.service.ts index 023dbbdcc..3deaf35c1 100644 --- a/apps/octra/src/app/core/store/idb/idb-effects.service.ts +++ b/apps/octra/src/app/core/store/idb/idb-effects.service.ts @@ -131,8 +131,8 @@ export class IDBEffects { if (state.application.mode === LoginMode.ONLINE) { this.store.dispatch( LoginModeActions.loadProjectAndTaskInformation.do({ - projectID: action.onlineOptions.project!.id, - taskID: action.onlineOptions.transcriptID!, + projectID: action.onlineOptions.project?.id, + taskID: action.onlineOptions.transcriptID ?? undefined, mode: LoginMode.ONLINE, }) ); diff --git a/apps/octra/src/app/core/store/login-mode/annotation/annotation.effects.ts b/apps/octra/src/app/core/store/login-mode/annotation/annotation.effects.ts index 2ae644b53..92125eada 100644 --- a/apps/octra/src/app/core/store/login-mode/annotation/annotation.effects.ts +++ b/apps/octra/src/app/core/store/login-mode/annotation/annotation.effects.ts @@ -38,7 +38,6 @@ import { } from '@octra/annotation'; import { AppStorageService } from '../../../shared/service/appstorage.service'; import { - CurrentAccountDto, ProjectDto, TaskDto, TaskInputOutputCreatorType, @@ -131,7 +130,6 @@ export class AnnotationEffects { ) ) ); - } else if (state.application.mode) { } return of( @@ -577,27 +575,58 @@ export class AnnotationEffects { withLatestFrom(this.store), exhaustMap(([a, state]) => { if (a.mode === LoginMode.ONLINE) { - return forkJoin< - [CurrentAccountDto, ProjectDto | undefined, TaskDto | undefined] - >( - this.apiService.getMyAccountInformation(), - this.apiService - .getProject(a.projectID) - .pipe(catchError((a) => of(undefined))), - this.apiService - .getTask(a.projectID, a.taskID) - .pipe(catchError((a) => of(undefined))) - ).pipe( - map(([currentAccount, currentProject, task]) => { - return LoginModeActions.loadProjectAndTaskInformation.success({ - mode: LoginMode.ONLINE, - me: currentAccount, - currentProject: currentProject ?? undefined, - task: task ?? undefined, - }); + return this.apiService.getMyAccountInformation().pipe( + exhaustMap((currentAccount) => { + if (!a.taskID || !a.projectID) { + return of( + LoginModeActions.loadProjectAndTaskInformation.success({ + mode: LoginMode.ONLINE, + me: currentAccount, + }) + ); + } + + return forkJoin<[ProjectDto | undefined, TaskDto | undefined]>( + this.apiService + .getProject(a.projectID) + .pipe(catchError((b) => of(undefined))), + this.apiService + .getTask(a.projectID, a.taskID) + .pipe(catchError((b) => of(undefined))) + ).pipe( + map(([currentProject, task]) => { + return LoginModeActions.loadProjectAndTaskInformation.success( + { + mode: LoginMode.ONLINE, + me: currentAccount, + currentProject: currentProject ?? undefined, + task: task ?? undefined, + } + ); + }), + catchError((error: HttpErrorResponse) => { + return checkAndThrowError( + { + statusCode: error.status, + message: error.error?.message ?? error.message, + }, + a, + LoginModeActions.loadProjectAndTaskInformation.fail({ + error, + }), + this.store, + () => { + this.alertService.showAlert( + 'danger', + error.error?.message ?? error.message + ); + } + ); + }) + ); }), - catchError((error: HttpErrorResponse) => { - return checkAndThrowError( + catchError((error) => + checkAndThrowError( { statusCode: error.status, message: error.error?.message ?? error.message, @@ -613,8 +642,8 @@ export class AnnotationEffects { error.error?.message ?? error.message ); } - ); - }) + ) + ) ); } else if ( [LoginMode.DEMO, LoginMode.LOCAL, LoginMode.URL].includes(a.mode) @@ -657,7 +686,7 @@ export class AnnotationEffects { }), ]).pipe( exhaustMap(([projectConfig, guidelines, functions]) => { - const currentProject = createSampleProjectDto(a.projectID); + const currentProject = createSampleProjectDto('1234'); let inputs: TaskInputOutputDto[] = []; @@ -716,7 +745,7 @@ export class AnnotationEffects { } const task = createSampleTask( - a.taskID, + a.taskID ?? '-1', inputs, [], projectConfig, diff --git a/apps/octra/src/app/core/store/login-mode/login-mode.actions.ts b/apps/octra/src/app/core/store/login-mode/login-mode.actions.ts index 9787cdaee..5be31d298 100644 --- a/apps/octra/src/app/core/store/login-mode/login-mode.actions.ts +++ b/apps/octra/src/app/core/store/login-mode/login-mode.actions.ts @@ -47,8 +47,8 @@ export class LoginModeActions extends AnnotationActions { source: `annotation/ load project and task information`, events: { do: props<{ - projectID: string; - taskID: string; + projectID?: string; + taskID?: string; mode: LoginMode; }>(), success: props<{