TSK-1305: Adapt classification type when entering a deep link

This commit is contained in:
Sofie Hofmann 2020-06-30 11:02:00 +02:00
parent 288b30ef58
commit db9175a3f6
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,8 @@ import { takeUntil } from 'rxjs/operators';
import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors'; import { ClassificationSelectors } from '../../../shared/store/classification-store/classification.selectors';
import { ClassificationDefinition } from '../../../shared/models/classification-definition'; import { ClassificationDefinition } from '../../../shared/models/classification-definition';
import { ACTION } from '../../../shared/models/action'; import { ACTION } from '../../../shared/models/action';
import { SelectClassification, import { GetClassifications,
SelectClassification,
SetActiveAction } from '../../../shared/store/classification-store/classification.actions'; SetActiveAction } from '../../../shared/store/classification-store/classification.actions';
@Component({ @Component({
@ -35,7 +36,8 @@ export class ClassificationOverviewComponent implements OnInit, OnDestroy {
if (this.routerParams.id) { if (this.routerParams.id) {
this.showDetail = true; this.showDetail = true;
this.store.dispatch(new SelectClassification(this.routerParams.id)); this.store.dispatch(new SelectClassification(this.routerParams.id))
.subscribe(() => this.store.dispatch(new GetClassifications()));
} }
if (this.routerParams.id && this.routerParams.id.indexOf('new-classification') !== -1) { if (this.routerParams.id && this.routerParams.id.indexOf('new-classification') !== -1) {
this.store.dispatch(new SetActiveAction(ACTION.CREATE)); this.store.dispatch(new SetActiveAction(ACTION.CREATE));

View File

@ -52,7 +52,8 @@ export class ClassificationState implements NgxsAfterBootstrap {
selectedClassification => { selectedClassification => {
ctx.patchState({ ctx.patchState({
selectedClassification, selectedClassification,
action: ACTION.DEFAULT action: ACTION.DEFAULT,
selectedClassificationType: selectedClassification.type
}); });
} }
)); ));