File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import {
13
13
import { Logo } from '../Sidebar/Logo'
14
14
import { useRoute } from 'kabouter'
15
15
import { styled } from '@based/ui'
16
- import { useAuthState } from '@based/react'
16
+ import { useAuthState , useQuery } from '@based/react'
17
17
import { languages as allLangs } from './languages'
18
18
19
19
export const TopBar = ( {
@@ -23,11 +23,15 @@ export const TopBar = ({
23
23
selectedLang,
24
24
setSelectedLang,
25
25
} ) => {
26
- const authState = useAuthState ( )
27
26
const route = useRoute ( '[section]' )
28
- const section = route . query . section
27
+
29
28
const { theme, setTheme } = useTheme ( )
30
29
30
+ const { data : userData } = useQuery ( 'db' , {
31
+ $id : client . authState . userId ,
32
+ name : true ,
33
+ } )
34
+
31
35
const langOptions = languages ?. map ( ( lang ) => ( {
32
36
value : lang ,
33
37
label : allLangs [ lang ] ,
@@ -60,7 +64,7 @@ export const TopBar = ({
60
64
< Dropdown . Root >
61
65
< Dropdown . Trigger >
62
66
< Button size = "xsmall" >
63
- < Avatar src = { data ?. profileImg } > { authState . userId } </ Avatar >
67
+ < Avatar src = { data ?. profileImg } > { userData ?. name } </ Avatar >
64
68
</ Button >
65
69
</ Dropdown . Trigger >
66
70
< Dropdown . Items >
Original file line number Diff line number Diff line change @@ -68,9 +68,15 @@ export const Management = () => {
68
68
< Modal . Actions >
69
69
< Button onClick = { close } > Cancel</ Button >
70
70
< Button
71
- onClick = { async ( ) =>
72
- client . call ( 'register' , { name, email } )
73
- }
71
+ onClick = { async ( ) => {
72
+ client
73
+ . call ( 'register' , { name, email } )
74
+ . catch ( ( err ) => {
75
+ console . error ( err )
76
+ } )
77
+
78
+ close ( )
79
+ } }
74
80
>
75
81
Confirm
76
82
</ Button >
You can’t perform that action at this time.
0 commit comments