File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -116,13 +116,11 @@ export const auth = betterAuth({
116116 } ,
117117 hooks : {
118118 after : createAuthMiddleware ( async ( ctx ) => {
119- console . log ( ctx . path , ctx . body ) ;
119+ const userId = ctx . body ?. userId as string | undefined ;
120120 switch ( ctx . path ) {
121121 case '/admin/update-user' :
122- case '/admin/ban-user' :
123122 case '/admin/unban-user' :
124123 case '/admin/set-user-password' :
125- const { userId } = ctx . body as { userId ?: string } ;
126124 if ( userId ) {
127125 const user = await User . findModel ( userId ) ;
128126 if ( user ) {
@@ -137,6 +135,21 @@ export const auth = betterAuth({
137135 }
138136 }
139137 break ;
138+ case '/admin/ban-user' :
139+ if ( userId ) {
140+ const user = await User . findModel ( userId ) ;
141+ if ( user ) {
142+ notify ( {
143+ to : [ IoRoom . ADMIN ] ,
144+ event : IoEvent . CHANGED_RECORD ,
145+ message : {
146+ type : RecordType . User ,
147+ record : user
148+ }
149+ } ) ;
150+ getIo ( ) . to ( user . id ) . emit ( IoEvent . ACTION , 'nav-reload' ) ;
151+ }
152+ }
140153 default :
141154 return ;
142155 }
You can’t perform that action at this time.
0 commit comments