Unverified Commit 3ab15295 authored by andreswebs's avatar andreswebs
Browse files

update: add test step to lint-staged

parent 90e69eea
......@@ -13,6 +13,7 @@
"chart.js": "^2.9.3",
"chartist": "^0.11.4",
"classnames": "^2.2.6",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0",
......@@ -80,7 +81,8 @@
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix"
"eslint --fix",
"cross-env CI=true react-scripts test --findRelatedTests"
]
}
}
}
\ No newline at end of file
......@@ -16,12 +16,6 @@ export function isLoggedIn() {
return Boolean(getAuthToken());
}
export function requireAuth(nextState, replace) {
if (!isLoggedIn()) {
replace('/');
}
}
function handleFetchErrors(response) {
if (!response.ok) {
const error = new Error(response.statusText);
......@@ -60,6 +54,8 @@ export function fetchApi(args) {
window.history.go('/login');
}
const apiErrorResponse = await error.response.json();
return Promise.reject(Object.assign(new Error(), apiErrorResponse));
apiErrorResponse.status = error.response.status;
apiErrorResponse.statusText = error.response.statusText;
throw Object.assign(new Error(), apiErrorResponse);
});
}
......@@ -3213,7 +3213,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
cross-spawn@7.0.1, cross-spawn@^7.0.0:
cross-env@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
dependencies:
cross-spawn "^7.0.1"
cross-spawn@7.0.1, cross-spawn@^7.0.0, cross-spawn@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14"
integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment