diff --git a/src/app/features/project/project.component.ts b/src/app/features/project/project.component.ts index 9829312f2..d1dcfd443 100644 --- a/src/app/features/project/project.component.ts +++ b/src/app/features/project/project.component.ts @@ -100,11 +100,7 @@ export class ProjectComponent implements OnDestroy { }); effect(() => { - const licenseId = this.currentProject()?.licenseId; - - if (licenseId) { - this.actions.getLicense(licenseId); - } + this.actions.getLicense(this.currentProject()?.licenseId); }); effect(() => { diff --git a/src/app/features/registry/models/registry-overview.model.ts b/src/app/features/registry/models/registry-overview.model.ts index 2de035367..bab443fd7 100644 --- a/src/app/features/registry/models/registry-overview.model.ts +++ b/src/app/features/registry/models/registry-overview.model.ts @@ -4,7 +4,7 @@ import { RegistrationNodeModel } from '@shared/models/registration/registration- export interface RegistrationOverviewModel extends RegistrationNodeModel { associatedProjectId?: string; forksCount: number; - licenseId: string; + licenseId?: string; providerId: string; registrationSchemaLink: string; rootParentId?: string; diff --git a/src/app/features/registry/store/registry/registry.actions.ts b/src/app/features/registry/store/registry/registry.actions.ts index 8a32ffe8c..70b702ffb 100644 --- a/src/app/features/registry/store/registry/registry.actions.ts +++ b/src/app/features/registry/store/registry/registry.actions.ts @@ -27,7 +27,7 @@ export class GetRegistryIdentifiers { export class GetRegistryLicense { static readonly type = '[Registry] Get Registry License'; - constructor(public licenseId: string) {} + constructor(public licenseId: string | undefined) {} } export class GetSchemaBlocks { diff --git a/src/app/features/registry/store/registry/registry.state.ts b/src/app/features/registry/store/registry/registry.state.ts index bceed584d..778fcb967 100644 --- a/src/app/features/registry/store/registry/registry.state.ts +++ b/src/app/features/registry/store/registry/registry.state.ts @@ -91,9 +91,8 @@ export class RegistryState { if (registryOverview.providerId) { ctx.dispatch(new GetRegistryProvider(registryOverview.providerId)); } - if (registryOverview.licenseId) { - ctx.dispatch(new GetRegistryLicense(registryOverview.licenseId)); - } + + ctx.dispatch(new GetRegistryLicense(registryOverview.licenseId)); }), catchError((error) => handleSectionError(ctx, 'registry', error)) ); @@ -149,6 +148,10 @@ export class RegistryState { @Action(GetRegistryLicense) getRegistryLicense(ctx: StateContext, action: GetRegistryLicense) { + if (!action.licenseId) { + return; + } + const state = ctx.getState(); ctx.patchState({ license: {