I am in need of a function that will assess various conditions to determine if an object is eligible for editing.
These conditions may exist on both the server and client sides.
Certain conditions should halt further validation and return a value.
I will attempt to clarify this process using pseudocode.
There may be an established pattern for executing such tasks already.
isEditable(): Observable<boolean> {
return serverSideCondition.pipe(
switchMap(editable => {
if (editable)
{
return clientSideCondition;
}
return of(false); // Should abort further conditions ...
}),
switchMap(editable => {
if (editable)
{
return clientSideAskTheUser;
}
return of(false); // Should abort further conditions ...
})
);
}
Thanks