Commit ec13ad21 authored by Remy Huet's avatar Remy Huet

Fix category destructure : only if exists. Enable conditional assignment

parent bcb813b6
Pipeline #31066 passed with stage
in 2 minutes and 28 seconds
......@@ -4,5 +4,8 @@
"env": {
"browser": true,
"jest": true
},
"rules": {
"no-cond-assign":"off"
}
}
\ No newline at end of file
......@@ -31,12 +31,15 @@ function Categories({
/>));
// Get single category attributes
let cat;
const {
name = null,
id = null,
parent_id: parentId = null,
parent = null,
} = params.category ? categories.find(c => c.id === parseInt(params.category, 10)) : {};
} = (params.category && (cat = categories.find(c => c.id === parseInt(params.category, 10))))
? cat
: {};
if (!categoriesFetched && !categoriesFetching) {
dispatch(fetchCategories(userToken));
......
Markdown is supported
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