ketting
ketting copied to clipboard
Allow to 'optionally' follow a relation
Often, I am not sure a relation will be present or not when a server-side permission is involved.
I'd like to avoid this kind of code:
if (userState.links.has('identity')) {
identityState = await userState.follow('identity').get();
}
And have something like this instead:
// this would lead to an undefined identityState if the relation 'identity' is absent
identityState = await userState.mayFollow('identity').get();