1
1
import { Button } from '@openfun/cunningham-react' ;
2
2
import Image from 'next/image' ;
3
- import { ReactElement } from 'react' ;
3
+ import { ReactElement , useCallback } from 'react' ;
4
4
import { useTranslation } from 'react-i18next' ;
5
5
import styled from 'styled-components' ;
6
6
7
+ import api from 'zotero-api-client' ;
7
8
import img403 from '@/assets/icons/icon-403.png' ;
8
- import { Box , Icon , StyledLink , Text } from '@/components' ;
9
+ import { Box , Icon , Text } from '@/components' ;
9
10
import { PageLayout } from '@/layouts' ;
10
11
import { NextPageWithLayout } from '@/types/next' ;
11
12
13
+
12
14
const StyledButton = styled ( Button ) `
13
15
width: fit-content;
14
16
` ;
15
17
16
18
const Page : NextPageWithLayout = ( ) => {
17
19
const { t } = useTranslation ( ) ;
18
20
21
+ const fetchFromZotero = useCallback ( async ( ) => {
22
+ const apiKey = '' ;
23
+ const myapi = api ( apiKey ) . library ( 'user' , 475425 ) ; //
24
+ const itemsResponse = await myapi . items ( ) . get ( ) ;
25
+
26
+ console . log ( itemsResponse ) ;
27
+ } , [ ] ) ;
28
+
19
29
return (
20
30
< Box
21
31
$align = "center"
@@ -40,11 +50,12 @@ const Page: NextPageWithLayout = () => {
40
50
) }
41
51
</ Text >
42
52
43
- < StyledLink href = "/" >
44
- < StyledButton icon = { < Icon iconName = "house" $color = "white" /> } >
45
- { t ( 'Home' ) }
46
- </ StyledButton >
47
- </ StyledLink >
53
+ < StyledButton
54
+ onClick = { ( ) => fetchFromZotero ( ) }
55
+
56
+ icon = { < Icon iconName = "house" $color = "white" /> } >
57
+ { t ( 'Home' ) }
58
+ </ StyledButton >
48
59
</ Box >
49
60
</ Box >
50
61
) ;
0 commit comments