mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Refine team API keys and member invitation sections.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
35b1ab6e90
commit
4ec328066c
@ -13,13 +13,13 @@ export function TeamApiKeysSection(props: { team: Team }) {
|
||||
const team = user.useTeam(props.team.id);
|
||||
const stackApp = useStackApp();
|
||||
const project = stackApp.useProject();
|
||||
const manageApiKeysPermission = user.usePermission(props.team, '$manage_api_keys');
|
||||
|
||||
if (!team) {
|
||||
throw new HexclaveAssertionError("Team not found");
|
||||
}
|
||||
|
||||
const teamApiKeysEnabled = project.config.allowTeamApiKeys;
|
||||
const manageApiKeysPermission = user.usePermission(props.team, '$manage_api_keys');
|
||||
if (!manageApiKeysPermission || !teamApiKeysEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ function MemberInvitationsSectionInvitationsList(props: { team: Team }) {
|
||||
<TableCell className="py-3 px-4 text-right">
|
||||
{removeMemberPermission && (
|
||||
<Button
|
||||
onClick={async () => await invitation.revoke()}
|
||||
onClick={async () => { await invitation.revoke(); }}
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-red-500 hover:bg-zinc-100 dark:hover:bg-zinc-900 rounded-lg transition-colors"
|
||||
@ -107,6 +107,7 @@ function MemberInvitationSectionInner(props: { team: Team }) {
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [invitedEmail, setInvitedEmail] = useState<string | null>(null);
|
||||
const watchedEmail = watch('email');
|
||||
|
||||
const onSubmit = async (data: yup.InferType<typeof invitationSchema>) => {
|
||||
setLoading(true);
|
||||
@ -121,7 +122,7 @@ function MemberInvitationSectionInner(props: { team: Team }) {
|
||||
|
||||
useEffect(() => {
|
||||
setInvitedEmail(null);
|
||||
}, [watch('email')]);
|
||||
}, [watchedEmail]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user