pavle-doby
function toShowLoader() {
const isFetching = apiStore[apiCallName] === "fetching";
const isAdmin = permissionStore.role === "admin";
const isListEmpty = !topTierList.length;
return isFetching && isAdmin && isListEmpty;
}
if (toShowLoader()) {
showLoader();
}
if (
apiStore[apiCallName] === "fetching" &&
permissionStore.role === "admin" &&
!topTierList.length
) {
showLoader();
}
Encapsulate conditionals
Pavle Marinkovic