File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -73,23 +73,18 @@ export function SidebarProvider({ children }: SidebarProviderProps) {
7373 loading,
7474 error,
7575 } = useAsync ( async ( ) => {
76- let categories = [ ]
77- let userId = null
78- if ( slug ) {
79- const { user, error } = await getUserBySlug ( {
80- slug : slug as string ,
81- isSameUser : false ,
82- } )
83-
84- if ( error ) {
85- throw new Error ( error )
86- }
8776
88- userId = user ?. userId
77+ let userId = null
78+ if ( slug ) {
79+ const { user, error } = await getUserBySlug ( {
80+ slug : slug as string ,
81+ isSameUser : false
82+ } ) ;
83+ if ( error ) throw error
84+ userId = user ? user ?. userId : null
8985 }
90-
91- categories = await getCategories ( )
92-
86+
87+ const categories = await getCategories ( userId )
9388 const categoriesObj = {
9489 categoriesChatbots : categories || [ ] ,
9590 categoriesId : categories . map ( ( category ) => category . categoryId ) ,
Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ export async function getCategories(userId?: string) {
5959 } ,
6060 } ,
6161 __scalar : true ,
62+ __args : userId ? {
63+ where : {
64+ chatbot : {
65+ threads : {
66+ userId : { _eq : userId }
67+ }
68+ }
69+ }
70+ } : { } ,
6271 } ,
6372 __scalar : true ,
6473 __args : {
Original file line number Diff line number Diff line change 2828 ],
2929 "packageManager" : " bun@1.1.31" ,
3030 "dependencies" : {
31- "axios" : " ^1.7.7" ,
32- "remark-gfm" : " ^4.0.0"
31+ "axios" : " ^1.7.7"
3332 }
3433}
You can’t perform that action at this time.
0 commit comments