src/utils/helpers/superagentPlugin.js
Function superagentPlugin
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var superagentPlugin = function(config = {}) {
if (config.disable == null) {
config.disable = {}
}
return function(request) {
Function end
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
request.end = function(fn) {
if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
request = request.set(state.auth.header, state.auth.token)
}
request._end(function(err, res) { // TODO: REFACTOR THIS
Consider simplifying this complex logical expression. Open
Open
if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
request = request.set(state.auth.header, state.auth.token)
}