File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { UserOutlined } from "@ant-design/icons" ;
2
+ import {
3
+ useQuery ,
4
+ } from "@tanstack/react-query" ;
5
+ import { Tooltip } from "antd" ;
6
+ import axios from "axios" ;
7
+
8
+ export interface IIdgAccountProps {
9
+ style ?:React . CSSProperties
10
+ }
11
+
12
+
13
+ export const IdgAccount : React . FC < IIdgAccountProps > = ( { style } ) => {
14
+
15
+ const { data} = useQuery ( {
16
+ queryKey : [ 'whoami' ] ,
17
+ queryFn : ( ) =>
18
+ axios
19
+ . get ( "https://www.geo2france.fr/whoami" )
20
+ . then ( ( res ) => res . data ) ,
21
+ } )
22
+
23
+ const username = data ?. GeorchestraUser ?. username ;
24
+ const authentified = username != 'anonymousUser' ? true : false ;
25
+
26
+ return (
27
+ < span style = { style } > { authentified ?
28
+ < > < Tooltip title = "Vous êtes authentifié sur la plateforme Géo2France" >
29
+ < UserOutlined />
30
+ </ Tooltip >
31
+ < a href = "https://www.geo2france.fr/portail/user/" > { username } </ a > </ >
32
+ : < > </ >
33
+ }
34
+ </ span >
35
+ )
36
+ }
Original file line number Diff line number Diff line change @@ -21,9 +21,10 @@ export const AppSider: React.FC = () => {
21
21
22
22
import React , { CSSProperties } from "react" ;
23
23
import { useMenu , } from "@refinedev/core" ;
24
- import { Layout , Menu , theme } from "antd" ;
24
+ import { Divider , Layout , Menu , theme } from "antd" ;
25
25
import type { RefineThemedLayoutV2SiderProps } from "@refinedev/antd" ;
26
26
import { NavLink } from "react-router-dom" ;
27
+ import { IdgAccount } from "../components/g2faccount" ;
27
28
28
29
/*const drawerButtonStyles: CSSProperties = {
29
30
borderTopLeftRadius: 0,
@@ -78,6 +79,8 @@ export const CustomSider: React.FC<RefineThemedLayoutV2SiderProps> = ({}) => {
78
79
< Menu items = { items } selectedKeys = { [ selectedKey ] } mode = "inline" style = { { marginTop :"20px" } } >
79
80
80
81
</ Menu >
82
+ < Divider />
83
+ < IdgAccount style = { { paddingLeft : "24px" } } />
81
84
</ Layout . Sider >
82
85
)
83
86
}
You can’t perform that action at this time.
0 commit comments