Closed conor-mac-aoidh closed 7 years ago
@vic I would welcome feedback on this commit
The reason for resolve
instead of reject
is to mirror the default apollo-client, which calls the afterware regardless of the response type. This enables afterware to check the response, and throw an error if required. This solves the issue mentioned here and enables afterware such as:
export function applyAfterware({response, options}, next) {
if (!!response.error && response.error === 'Unauthorized') {
throw new Error('Unauthorized');
}
next();
}
Looks good to me, thank you very much. Merging 🎉
Small fix that checks whether to execute a middleware or afterware method