Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7007b51

Browse files
author
dengjun
committed
integration profile
2 parents 88cc0a4 + 505adcb commit 7007b51

File tree

13 files changed

+239
-847
lines changed

13 files changed

+239
-847
lines changed

config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
URL: {
1111
BASE: "https://www.topcoder-dev.com",
1212
COMMUNITY_APP: "https://community-app.topcoder-dev.com",
13-
PLATFORM_WEBSITE_URL: "https://platform.topcoder-dev.com",
13+
PLATFORM_WEBSITE_URL: "http://local.topcoder-dev.com:8008",
1414
},
1515
RECRUIT_API: process.env.RECRUIT_API || "https://www.topcoder-dev.com",
1616
// the server api base path

config/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports = {
99
URL: {
1010
BASE: "https://www.topcoder-dev.com",
1111
COMMUNITY_APP: "https://community-app.topcoder-dev.com",
12-
PLATFORM_WEBSITE_URL: "https://platform.topcoder-dev.com",
12+
PLATFORM_WEBSITE_URL: "http://local.topcoder-dev.com:8008",
1313
},
1414
};

config/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports = {
99
URL: {
1010
BASE: "https://www.topcoder.com",
1111
COMMUNITY_APP: "https://community-app.topcoder.com",
12-
PLATFORM_WEBSITE_URL: "https://platform.topcoder.com",
12+
PLATFORM_WEBSITE_URL: "http://local.topcoder-dev.com:8008",
1313
},
1414
};

src/actions/lookup.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,37 @@ async function getGigStatuses() {
2121
return service.getGigStatuses();
2222
}
2323

24+
/**
25+
* Gets all the countries.
26+
* @returns {Array} Array containing all countries
27+
*/
28+
async function getAllCountries() {
29+
// fetch the first page to see how many more fetches are necessary to get all
30+
const countries = await service.getPaginatedCountries();
31+
const {
32+
meta: { totalPages },
33+
} = countries;
34+
35+
const pagesMissing = totalPages - 1;
36+
37+
// fetch the other pages.
38+
const allPageResults = await Promise.all(
39+
[...Array(pagesMissing > 0 ? pagesMissing : 0)].map((_, index) => {
40+
const newPage = index + 2;
41+
42+
return service.getPaginatedCountries(newPage);
43+
})
44+
);
45+
46+
const newCountries = allPageResults.map((data) => data).flat();
47+
return [...countries, ...newCountries];
48+
}
49+
2450
export default createActions({
2551
GET_TAGS: getTags,
2652
GET_COMMUNITY_LIST: getCommunityList,
2753
CHECK_IS_LOGGED_IN: checkIsLoggedIn,
2854
GET_GIG_PHASES: getGigPhases,
2955
GET_GIG_STATUSES: getGigStatuses,
56+
GET_ALL_COUNTRIES: getAllCountries,
3057
});

0 commit comments

Comments
 (0)