Function setLoading
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const setLoading = value => {
if (value) {
if (pendingRequests === 0) Vue.prototype.$Loading.start();
pendingRequests++;
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function responseErrorInterceptor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const responseErrorInterceptor = error => {
setLoading(false);
if (!has(error, 'response.status') || (error.request.responseType === 'blob' && error.request.status === 404)) {
return Promise.reject(error);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'axios'
with "axios"
Open
import axios from 'axios';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
} else {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'vue'
with "vue"
Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
if (value) {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ········
with ····
Open
if (pendingRequests === 0) Vue.prototype.$Loading.start();
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace '@/store'
with "@/store"
Open
import store from '@/store';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'vue/attributes-order' was not found Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'lodash/has'
with "lodash/has"
Open
import has from 'lodash/has';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
pendingRequests++;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error Open
import Vue from 'vue';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
}, 300);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····
with ··
Open
setLoading(false);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············
with ······
Open
break;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
case 503:
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ··········:·'Internal·server·error'
with :·"Internal·server·error"
Open
: 'Internal server error',
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
}
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
return config;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
}
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
switch (error.response.status) {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············
with ······
Open
Vue.prototype.$Notify.error({
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
// Generate cancel token source
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
return config;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ········
with ····
Open
setTimeout(() => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····
with ··
Open
}
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ········
with ····
Open
default:
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····················
with ··········
Open
? error.response.data.error.message
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'access_token'
with "access_token"
Open
const getAuthToken = () => localStorage.getItem('access_token');
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
setLoading(false);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
return response;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············store.getters['user/loggedIn']·&&·store.dispatch('user/forceUserExit',·'Data·reset'
with ······store.getters["user/loggedIn"]·&&⏎········store.dispatch("user/forceUserExit",·"Data·reset"
Open
store.getters['user/loggedIn'] && store.dispatch('user/forceUserExit', 'Data reset');
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
case 401:
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············
with ······
Open
break;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ················message:·has(error,·'response.data.error.message'
with ········message:·has(error,·"response.data.error.message"
Open
message: has(error, 'response.data.error.message')
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ················duration:·5000,
with ········duration:·5000
Open
duration: 5000,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ······
Open
});
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ··},
with }
Open
},
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············store.getters['user/loggedIn']·&&·store.dispatch('user/forceUserExit'
with ······store.getters["user/loggedIn"]·&&⏎········store.dispatch("user/forceUserExit"
Open
store.getters['user/loggedIn'] && store.dispatch('user/forceUserExit', error.response.data.message);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
axios.isCancel(error) ? setLoading(false) : Vue.prototype.$Loading.error();
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
}
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ····
Open
axios.interceptors.request.use(authInterceptor);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
return config;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
// Set cancel token on this request
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····
with ··)·{⏎
Open
return Promise.reject(error);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ················title:·'Error'
with ········title:·"Error"
Open
title: 'Error',
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ······
Open
if (pendingRequests > 0) pendingRequests--;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ············
with ······
Open
if (pendingRequests < 1) Vue.prototype.$Loading.finish();
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
setup() {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ··if·(!has(error,·'response.status')·||·(error.request.responseType·===·'blob'·&&·error.request.status·===·404))·{
with if·(⏎····!has(error,·"response.status")·||⏎····(error.request.responseType·===·"blob"·&&·error.request.status·===·404)
Open
if (!has(error, 'response.status') || (error.request.responseType === 'blob' && error.request.status === 404)) {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····
with ··
Open
return config;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
let source = axios.CancelToken.source();
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ········
with ····
Open
axios.interceptors.request.use(pendingRequestsInterceptor);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
return Promise.reject(error);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
if (config.ignoreCancel) {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
return Promise.reject(error);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
setLoading(true);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ··config.headers['Authorization'
with config.headers["Authorization"
Open
config.headers['Authorization'] = `Bearer ${getAuthToken()}`;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····
with ··
Open
config.cancelToken = source.token;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····store.commit('httpRequest/addCancelToken'
with ··store.commit("httpRequest/addCancelToken"
Open
store.commit('httpRequest/addCancelToken', source);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ····axios.interceptors.response.use(responseInterceptor,·responseErrorInterceptor);
with axios.interceptors.response.use(⏎······responseInterceptor,⏎······responseErrorInterceptor
Open
axios.interceptors.response.use(responseInterceptor, responseErrorInterceptor);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Insert );⏎
Open
axios.interceptors.request.use(requestInterceptor, requestErrorInterceptor);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/