Skip to content

Commit 080fb03

Browse files
authored
Merge pull request #274 from IFRCGo/fix/resource-contacts
Use contacts from the database
2 parents e56cee4 + 8024708 commit 080fb03

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

src/views/Resources/index.tsx

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Page from '#components/Page';
22
import Container from '#components/Container';
33
import Link from '#components/Link';
44
import useTranslation from '#hooks/useTranslation';
5+
import { useRequest } from '#utils/restRequest';
56
import { resolveToComponent } from '#utils/translation';
67

78
import arcLogo from '#assets/icons/arc_logo.png';
@@ -22,38 +23,12 @@ import VideoList from './VideoList';
2223
import i18n from './i18n.json';
2324
import styles from './styles.module.css';
2425

25-
// FIXME: region names can be used from the enum context
26-
const contacts = [
27-
{
28-
29-
name: 'Elly NANDASABA MULAHA',
30-
extent: 'Africa Region',
31-
},
32-
{
33-
34-
name: 'Luis FANOVICH',
35-
extent: 'America Region',
36-
},
37-
{
38-
39-
name: 'Dedi JUNADI',
40-
extent: 'Asia Pacific Region',
41-
},
42-
{
43-
44-
name: 'Anssi ANONEN',
45-
extent: 'Europe Region',
46-
},
47-
{
48-
49-
name: 'Ahmad AL JAMAL',
50-
extent: 'MENA Region',
51-
},
52-
];
53-
5426
// eslint-disable-next-line import/prefer-default-export
5527
export function Component() {
5628
const strings = useTranslation(i18n);
29+
const { response: contactsResponse } = useRequest({
30+
url: '/api/v2/main_contact/',
31+
});
5732

5833
const contactDescription = resolveToComponent(
5934
strings.aboutFurtherInfo,
@@ -266,7 +241,7 @@ export function Component() {
266241
headerDescription={contactDescription}
267242
childrenContainerClassName={styles.contactsList}
268243
>
269-
{contacts.map((contact) => (
244+
{contactsResponse?.results?.map((contact) => (
270245
<div
271246
className={styles.contact}
272247
key={contact.extent}

0 commit comments

Comments
 (0)