first commit

This commit is contained in:
2026-10-03 13:40:26 +02:00
parent 732a5b5a16
commit 566f415fa7
555 changed files with 62704 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { mapResponse } from '@ngrx/operators';
import { EventInstance } from '@ngrx/signals/events';
import { Observable } from 'rxjs';
import { describeError } from '../notifications';
type Creator = (message: string) => EventInstance<string, string>;
/** Runs a command and turns its outcome into a succeeded/failed event. */
export function runCommand<T>(
command$: Observable<T>,
successMessage: string,
succeeded: Creator,
failed: Creator,
) {
return command$.pipe(
mapResponse({
next: () => succeeded(successMessage),
error: (error) => failed(describeError(error)),
}),
);
}