mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 15:05:48 +01:00
♻️ Address pull request feedback
This commit is contained in:
44
src/components/Manage/User/Invite/delete-invite.modal.tsx
Normal file
44
src/components/Manage/User/Invite/delete-invite.modal.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Button, Group, Stack, Text } from '@mantine/core';
|
||||
import { ContextModalProps, modals } from '@mantine/modals';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { api } from '~/utils/api';
|
||||
|
||||
export const DeleteInviteModal = ({ id, innerProps }: ContextModalProps<{ tokenId: string }>) => {
|
||||
const { t } = useTranslation('manage/users/invites');
|
||||
const utils = api.useContext();
|
||||
const { isLoading, mutateAsync: deleteAsync } = api.invites.delete.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.invites.all.invalidate();
|
||||
modals.close(id);
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Stack>
|
||||
<Text>{t('modals.delete.description')}</Text>
|
||||
|
||||
<Group grow>
|
||||
<Button
|
||||
onClick={() => {
|
||||
modals.close(id);
|
||||
}}
|
||||
variant="light"
|
||||
color="gray"
|
||||
>
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await deleteAsync({
|
||||
tokenId: innerProps.tokenId,
|
||||
});
|
||||
}}
|
||||
disabled={isLoading}
|
||||
variant="light"
|
||||
color="red"
|
||||
>
|
||||
{t('common:delete')}
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user