Skip to content

Commit e7c9958

Browse files
committed
fix(data): update pagination limit
1 parent 1a7e71f commit e7c9958

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

src/utils/common.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
compareStringSearch,
55
} from '@togglecorp/fujs';
66
import { gql } from 'graphql-request';
7-
import graphqlRequest from 'utils/requests/graphqlRequest';
87
import { EnumsQuery } from 'generated/types';
98

109
export const enumsQuery = gql`
@@ -22,8 +21,6 @@ export const enumsQuery = gql`
2221
}
2322
`;
2423

25-
export const graphqlEndpoint = process.env.MAPSWIPE_COMMUNITY_API_ENDPOINT as string;
26-
2724
// FIXME: Find the value of supported project type
2825
export const supportedProjectTypes = [1, 2, 3, 4, 10, 7];
2926

@@ -103,27 +100,6 @@ export function memoize<A extends Array<any>, R>(func: (...args: A) => R) {
103100
};
104101
}
105102

106-
export async function fetchEnums() {
107-
const data = await graphqlRequest<{ enums: EnumsQuery['enums'] }>(
108-
graphqlEndpoint,
109-
);
110-
111-
const projectTypes = data?.enums.ProjectTypeEnum.map((item) => ({
112-
key: item.key,
113-
label: item.label,
114-
}));
115-
116-
const projectStatuses = data?.enums.ProjectStatusEnum.map((item) => ({
117-
key: item.key,
118-
label: item.label,
119-
}));
120-
121-
return {
122-
projectTypes,
123-
projectStatuses,
124-
};
125-
}
126-
127103
export type ProjectStatus = EnumsQuery['enums']['ProjectStatusEnum'][number]['key'];
128104
export type ProjectType = EnumsQuery['enums']['ProjectTypeEnum'][number]['key'];
129105

src/utils/queries.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export interface FeatureCollection {
3737
features: Feature[];
3838
}
3939

40+
// FIXME: Update this properly, implement recursive fetch
4041
export const projectsData = gql`
4142
query PublicProjects($filters: ProjectFilter) {
42-
publicProjects(filters: $filters) {
43+
publicProjects(filters: $filters, pagination: { limit: 9999 }) {
4344
results {
4445
id
4546
exportAggregatedResultsWithGeometry {
@@ -163,14 +164,15 @@ export const projectsData = gql`
163164
totalArea
164165
}
165166
}
167+
totalCount
166168
}
167169
communityStats {
168170
id
169171
totalContributors
170172
totalUserGroups
171173
totalSwipes
172174
}
173-
publicOrganizations {
175+
publicOrganizations(pagination: { limit: 9999 }) {
174176
results {
175177
id
176178
name

src/utils/requests/graphqlRequest.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ const COOKIE_NAME = `MAPSWIPE-${process.env.APP_ENVIRONMENT}-CSRFTOKEN`;
1010
// FIXME: Validate the urls in env
1111
const baseUrl = process.env.MAPSWIPE_API_ENDPOINT;
1212
const apiEndpoint = `${baseUrl}graphql/`;
13-
const graphQLClient = new GraphQLClient(apiEndpoint);
13+
const graphQLClient = new GraphQLClient(apiEndpoint, {
14+
/*
15+
fetch: async (url, options) => {
16+
console.log('>>> Fetch URL:', options);
17+
return fetch(url, options);
18+
},
19+
*/
20+
});
1421

1522
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention
1623
let __internal__csrfTokenValue: string;

0 commit comments

Comments
 (0)