Skip to content
Snippets Groups Projects
Verified Commit 6b86812c authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

OZG-7507 remove unknown type

parent 8de3618f
No related branches found
No related tags found
1 merge request!82OZG-7507 use new open dialog button
Showing with 14 additions and 13 deletions
...@@ -65,7 +65,7 @@ export abstract class KeycloakResourceService<T> { ...@@ -65,7 +65,7 @@ export abstract class KeycloakResourceService<T> {
protected abstract _saveInKeycloak(item: T): Observable<T>; protected abstract _saveInKeycloak(item: T): Observable<T>;
public delete(id: string): Observable<StateResource<unknown>> { public delete(id: string): Observable<StateResource<void>> {
return this.handleLoading(this._deleteInKeycloak(id)); return this.handleLoading(this._deleteInKeycloak(id));
} }
......
...@@ -51,7 +51,7 @@ describe('OrganisationsEinheitDeleteDialogContainerComponent', () => { ...@@ -51,7 +51,7 @@ describe('OrganisationsEinheitDeleteDialogContainerComponent', () => {
describe('template', () => { describe('template', () => {
describe('organisations einheit delete dialog', () => { describe('organisations einheit delete dialog', () => {
it('should exist', () => { it('should exist', () => {
const stateResource: StateResource<unknown> = createEmptyStateResource(); const stateResource: StateResource<void> = createEmptyStateResource();
component.deleteStateResource$ = of(stateResource); component.deleteStateResource$ = of(stateResource);
component.organisationsEinheitName = dialogData.organisationsEinheitName; component.organisationsEinheitName = dialogData.organisationsEinheitName;
...@@ -104,10 +104,10 @@ describe('OrganisationsEinheitDeleteDialogContainerComponent', () => { ...@@ -104,10 +104,10 @@ describe('OrganisationsEinheitDeleteDialogContainerComponent', () => {
}); });
describe('delete', () => { describe('delete', () => {
const stateResource: StateResource<unknown> = createEmptyStateResource(); const stateResource: StateResource<void> = createEmptyStateResource();
const stateResource$: Observable<StateResource<unknown>> = of(stateResource); const stateResource$: Observable<StateResource<void>> = of(stateResource);
const loadingStateResource: StateResource<unknown> = createEmptyStateResource(true); const loadingStateResource: StateResource<void> = createEmptyStateResource(true);
const loadingStateResource$: Observable<StateResource<unknown>> = of(loadingStateResource); const loadingStateResource$: Observable<StateResource<void>> = of(loadingStateResource);
beforeEach(() => { beforeEach(() => {
organisationsEinheitService.delete.mockReturnValue(stateResource$); organisationsEinheitService.delete.mockReturnValue(stateResource$);
......
...@@ -31,19 +31,20 @@ export class OrganisationsEinheitDeleteDialogContainerComponent { ...@@ -31,19 +31,20 @@ export class OrganisationsEinheitDeleteDialogContainerComponent {
this.organisationsEinheitId = this.dialogData.organisationsEinheitId; this.organisationsEinheitId = this.dialogData.organisationsEinheitId;
} }
public deleteStateResource$: Observable<StateResource<unknown>> = of(createEmptyStateResource()); public deleteStateResource$: Observable<StateResource<void>> = of(createEmptyStateResource<void>());
public closeDialog(): void { public closeDialog(): void {
this.dialogService.closeAll(); this.dialogService.closeAll();
} }
public delete(): void { public delete(): void {
this.deleteStateResource$ = this.organisationsEinheitService this.deleteStateResource$ = this.organisationsEinheitService.delete(this.organisationsEinheitId).pipe(
.delete(this.organisationsEinheitId) tap(console.info),
.pipe(tap((stateResource: StateResource<unknown>) => this.closeDialogOnDeleteDone(stateResource))); tap((stateResource: StateResource<void>) => this.closeDialogOnDeleteDone(stateResource)),
);
} }
private closeDialogOnDeleteDone(stateResource: StateResource<unknown>): void { private closeDialogOnDeleteDone(stateResource: StateResource<void>): void {
if (isNotLoading(stateResource)) { if (isNotLoading(stateResource)) {
this.dialogService.closeAll(); this.dialogService.closeAll();
} }
......
...@@ -58,7 +58,7 @@ describe('OrganisationsEinheitDeleteDialogComponent', () => { ...@@ -58,7 +58,7 @@ describe('OrganisationsEinheitDeleteDialogComponent', () => {
}); });
it('should have inputs', () => { it('should have inputs', () => {
const stateResource: StateResource<unknown> = createEmptyStateResource(); const stateResource: StateResource<void> = createEmptyStateResource();
component.deleteStateResource = stateResource; component.deleteStateResource = stateResource;
fixture.detectChanges(); fixture.detectChanges();
......
...@@ -11,7 +11,7 @@ import { ButtonComponent } from '@ods/system'; ...@@ -11,7 +11,7 @@ import { ButtonComponent } from '@ods/system';
}) })
export class OrganisationsEinheitDeleteDialogComponent { export class OrganisationsEinheitDeleteDialogComponent {
@Input() organisationsEinheitName: string; @Input() organisationsEinheitName: string;
@Input() deleteStateResource: StateResource<unknown>; @Input() deleteStateResource: StateResource<void>;
@Output() cancel: EventEmitter<void> = new EventEmitter<void>(); @Output() cancel: EventEmitter<void> = new EventEmitter<void>();
@Output() delete: EventEmitter<void> = new EventEmitter<void>(); @Output() delete: EventEmitter<void> = new EventEmitter<void>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment