Skip to content

TypeScript API / contentia/json-api / resolveAuthorization

Function: resolveAuthorization() ​

ts
function resolveAuthorization(decision): 
  | ContentiaError<ErrorCode, number>
  | null;

Normalise an AuthorizeDecision into either null (allowed) or the ContentiaError that should be returned to the client. A bare false becomes a generic ForbiddenError; a returned error is passed through unchanged so its own code/status drive the HTTP response.

Parameters ​

ParameterType
decisionAuthorizeDecision

Returns ​

| ContentiaError<ErrorCode, number> | null