Fix rounds management bugs and invitation flow
- Fix rounds list showing 0 projects by adding _count to program.list query - Fix round reordering by using correct cache invalidation params - Fix finalizeResults to auto-advance passed projects to next round - Fix member list not updating after add/remove by invalidating user.list - Fix invitation link error page by correcting path from /auth-error to /error - Add /apply, /verify, /error to public paths in auth config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useState } from 'react'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { trpc } from '@/lib/trpc/client'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
@@ -38,12 +37,17 @@ interface UserActionsProps {
|
||||
}
|
||||
|
||||
export function UserActions({ userId, userEmail, userStatus }: UserActionsProps) {
|
||||
const router = useRouter()
|
||||
const [showDeleteDialog, setShowDeleteDialog] = useState(false)
|
||||
const [isSending, setIsSending] = useState(false)
|
||||
|
||||
const utils = trpc.useUtils()
|
||||
const sendInvitation = trpc.user.sendInvitation.useMutation()
|
||||
const deleteUser = trpc.user.delete.useMutation()
|
||||
const deleteUser = trpc.user.delete.useMutation({
|
||||
onSuccess: () => {
|
||||
// Invalidate user list to refresh the members table
|
||||
utils.user.list.invalidate()
|
||||
},
|
||||
})
|
||||
|
||||
const handleSendInvitation = async () => {
|
||||
if (userStatus !== 'INVITED') {
|
||||
@@ -55,6 +59,8 @@ export function UserActions({ userId, userEmail, userStatus }: UserActionsProps)
|
||||
try {
|
||||
await sendInvitation.mutateAsync({ userId })
|
||||
toast.success(`Invitation sent to ${userEmail}`)
|
||||
// Invalidate in case status changed
|
||||
utils.user.list.invalidate()
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to send invitation')
|
||||
} finally {
|
||||
@@ -67,7 +73,6 @@ export function UserActions({ userId, userEmail, userStatus }: UserActionsProps)
|
||||
await deleteUser.mutateAsync({ id: userId })
|
||||
toast.success('User deleted successfully')
|
||||
setShowDeleteDialog(false)
|
||||
router.refresh()
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to delete user')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user