♻️ Rename registration token to invite, add created by

This commit is contained in:
Meier Lukas
2023-08-01 11:43:24 +02:00
parent df890b8c0a
commit f93d935175
18 changed files with 109 additions and 97 deletions

View File

@@ -0,0 +1,49 @@
import { Button, Group, Stack, Text } from '@mantine/core';
import { ContextModalProps, modals } from '@mantine/modals';
import { api } from '~/utils/api';
export const DeleteInviteModal = ({
context,
id,
innerProps,
}: ContextModalProps<{ tokenId: string }>) => {
const apiContext = api.useContext();
const { isLoading, mutateAsync } = api.invites.delete.useMutation({
onSuccess: async () => {
await apiContext.invites.all.invalidate();
modals.close(id);
},
});
return (
<Stack>
<Text>
Are you sure, that you want to delete this invitation? Users with this link will no longer
be able to create an account using that link.
</Text>
<Group grow>
<Button
onClick={() => {
modals.close(id);
}}
variant="light"
color="gray"
>
Cancel
</Button>
<Button
onClick={async () => {
await mutateAsync({
tokenId: innerProps.tokenId,
});
}}
disabled={isLoading}
variant="light"
color="red"
>
Delete
</Button>
</Group>
</Stack>
);
};