Skip to content

Commit

Permalink
polish about API response
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 23, 2023
1 parent b381522 commit dd3cffc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tools-public/toolpad/pages/muicomabout/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ spec:
- field: locationCountry
type: string
width: 178
- field: twitter
type: link
width: 277
- field: github
type: link
width: 258
- field: twitter
type: link
width: 277
height: 648
30 changes: 17 additions & 13 deletions tools-public/toolpad/resources/queryAbout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,21 @@ export async function queryAbout() {
const countries = await countriesRes.json();
const countryToISO = flip(countries);

return data.employees.map((employee) => {
const country = countryFix[employee.address.country] || employee.address.country;
return {
name: employee.fullName,
title: employee.work.title,
about: employee.about?.custom?.field_1690557141686,
location: `${employee.address.city} - ${country}`,
locationCountry: countryToISO[country],
twitter: employee.about?.socialData?.twitter,
github: employee.about?.custom?.field_1682954415714,
// ...employee,
};
});
return data.employees
.sort(
(a, b) => parseInt(b.work.tenureDurationYears, 10) - parseInt(a.work.tenureDurationYears, 10),
)
.map((employee) => {
const country = countryFix[employee.address.country] || employee.address.country;
return {
name: employee.fullName,
title: employee.work.title,
about: employee.about?.custom?.field_1690557141686,
location: `${employee.address.city} - ${country}`,
locationCountry: countryToISO[country],
twitter: employee.about?.socialData?.twitter,
github: employee.about?.custom?.field_1682954415714,
//...employee,
};
});
}

0 comments on commit dd3cffc

Please sign in to comment.