Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the ability to reload domains that are role dependent #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"serve:test": "cross-env NODE_ENV=test nodemon --exec babel-node server/index.js",
"start-front": "react-scripts start",
"build": "node ./buildScript",
"lint": "npx eslint --ext jsx,js src server",
"lint": "npx eslint --fix --ext jsx,js src server",
"test": "npm run lint && react-scripts test",
"test:e2e": "concurrently \"npm run serve:test\" \"cypress run\" --kill-others --success first",
"start": "concurrently \"npm run start-server\" \"npm run start-front\" --kill-others --kill-others-on-fail",
Expand Down
26 changes: 14 additions & 12 deletions src/pages/HomePage/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,29 @@ const HomePage = ({
const dispatch = useDispatch();

const [techParams, setTechParams] = useState(isTech);
const [previousTechParams, setPreviousTechParams] = useState(isTech);

const onSelectTech = (value) => {
setIsLoading(true);
setPreviousTechParams(isTech);
setTechParams(value);
dispatch(setSortByRoles(value));
};

useEffect(() => {
if (domains.length === 0) {
if (isTech === 'init') {
(async () => {
await fetchDomains(0, false, isTech);
setIsLoading(false);
})();
} else {
(async () => {
await fetchDomains(0, false, isTech);
setIsLoading(false);
})();
}
} else {
(async () => {
await fetchDomains(0, false, isTech);
setIsLoading(false);
})();
}
else if (previousTechParams !== isTech) {
(async () => {
await fetchDomains(0, false, isTech);
setIsLoading(false);
})();
}
else {
setIsLoading(false);
}
}, [fetchDomains, isTech]);
Expand Down
25 changes: 0 additions & 25 deletions src/redux/reducers/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,30 +143,6 @@ const failDomainUnlock = (payload) => ({
type: UNLOCK_DOMAIN_FAILURE,
});

// const fetchRawDomainList = async (isTech) => {
// let offset = 0;
// let domains = [];
// let count = 0;

// let res = await api.fetchDomains(null, offset, false, isTech);
// domains = domains.concat(res.data.domains);
// count = res.data.count;
// if (offset < count) {
// offset += 200;
// } else {
// return domains;
// }

// while (offset < count) {
// res = api.fetchDomains(null, offset, false);
// domains = domains.concat(res.data.domains);
// if (offset < count) {
// offset += 200;
// }
// }
// return domains;
// };

const fetchDomain = (uuid) => (dispatch) => {
dispatch(requestDomain());
return api
Expand Down Expand Up @@ -368,5 +344,4 @@ export {
lockDomain,
parseDomain,
unlockDomain,
// fetchRawDomainList,
};