Skip to content

Commit c89db7e

Browse files
committed
refactor(example): add more TS Types to callback methods
1 parent b8d1d14 commit c89db7e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/examples/grid-graphql-nopage.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class GridGraphqlWithoutPaginationComponent implements OnInit {
204204
};
205205
}
206206

207-
displaySpinner(isProcessing) {
207+
displaySpinner(isProcessing: boolean) {
208208
this.processing = isProcessing;
209209
this.status = (isProcessing)
210210
? { text: 'processing...', class: 'alert alert-danger' }
@@ -227,18 +227,18 @@ export class GridGraphqlWithoutPaginationComponent implements OnInit {
227227
* So we will have to write, by hand, the query to get the continents code & name
228228
* We also need to resolve the data in a flat array (singleSelect/multipleSelect Filters only accept data at the root of the array)
229229
*/
230-
getContinents() {
230+
getContinents(): Observable<GraphqlResult<{ code: string; name: string; }>> {
231231
const continentQuery = `query { continents { code, name }}`;
232-
return this.http.post<GraphqlResult<Country>>(COUNTRIES_API, { query: continentQuery });
232+
return this.http.post<GraphqlResult<{ code: string; name: string; }>>(COUNTRIES_API, { query: continentQuery });
233233
}
234234

235235
/**
236236
* Calling again the GraphQL backend API, however in this case we cannot use the GraphQL Service to build the query
237237
* So we will have to write, by hand, the query to get the languages code & name
238238
* We also need to resolve the data in a flat array (singleSelect/multipleSelect Filters only accept data at the root of the array)
239239
*/
240-
getLanguages() {
240+
getLanguages(): Observable<GraphqlResult<{ code: string; name: string; native: string; }>> {
241241
const languageQuery = `query { languages { code, name, native }}`;
242-
return this.http.post<GraphqlResult<Country>>(COUNTRIES_API, { query: languageQuery });
242+
return this.http.post<GraphqlResult<{ code: string; name: string; native: string; }>>(COUNTRIES_API, { query: languageQuery });
243243
}
244244
}

0 commit comments

Comments
 (0)