File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import { Button } from ' @/components/ui/button'
3
3
import { cn } from ' @/lib/utils'
4
+ import { useClerk } from ' vue-clerk'
4
5
import type { AllClubs } from ' ~/types/api/user/all_clubs'
5
6
7
+ const clerk = useClerk ()
8
+
6
9
const route = useRoute ()
7
10
8
11
const isPresidentOrVicePresident = ref (false )
9
12
10
- const { data } = await useFetch <AllClubs >(` /api/user/all_clubs ` , {
11
- headers: useRequestHeaders (),
12
- method: ' GET' ,
13
- })
14
-
15
- if (data .value && (data .value ?.president .length !== 0 || data .value ?.vice .length !== 0 )) {
16
- isPresidentOrVicePresident .value = true
13
+ if (import .meta .client ) {
14
+ if (clerk .user ?.publicMetadata .binded ) {
15
+ const data = await $fetch <AllClubs >(` /api/user/all_clubs ` , {
16
+ headers: useRequestHeaders (),
17
+ method: ' GET' ,
18
+ })
19
+ if (data && (data .president .length !== 0 || data .vice .length !== 0 )) {
20
+ isPresidentOrVicePresident .value = true
21
+ }
22
+ }
17
23
}
18
24
</script >
19
25
You can’t perform that action at this time.
0 commit comments