mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
go back to team settings on team delete
This commit is contained in:
parent
0016a9f4e1
commit
8969a010e8
@ -1,9 +1,17 @@
|
||||
import { ActionForm, Button, Modal, ModalTrigger } from 'react-basics';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { ActionForm, Button, Modal, ModalTrigger } from 'react-basics';
|
||||
import TeamDeleteForm from './TeamDeleteForm';
|
||||
import { touch } from 'store/modified';
|
||||
|
||||
export function TeamAdmin({ teamId }: { teamId: string }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const router = useRouter();
|
||||
|
||||
const handleLeave = async () => {
|
||||
touch('teams');
|
||||
router.push('/settings/teams');
|
||||
};
|
||||
|
||||
return (
|
||||
<ActionForm
|
||||
@ -13,7 +21,9 @@ export function TeamAdmin({ teamId }: { teamId: string }) {
|
||||
<ModalTrigger>
|
||||
<Button variant="danger">{formatMessage(labels.delete)}</Button>
|
||||
<Modal title={formatMessage(labels.deleteTeam)}>
|
||||
{(close: () => void) => <TeamDeleteForm teamId={teamId} onClose={close} />}
|
||||
{(close: () => void) => (
|
||||
<TeamDeleteForm teamId={teamId} onSave={handleLeave} onClose={close} />
|
||||
)}
|
||||
</Modal>
|
||||
</ModalTrigger>
|
||||
</ActionForm>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { useApi, useMessages } from 'components/hooks';
|
||||
import { touch } from 'store/modified';
|
||||
import TypeConfirmationForm from 'components/common/TypeConfirmationForm';
|
||||
import { useApi, useMessages } from 'components/hooks';
|
||||
|
||||
const CONFIRM_VALUE = 'DELETE';
|
||||
|
||||
@ -22,7 +21,6 @@ export function TeamDeleteForm({
|
||||
const handleConfirm = async () => {
|
||||
mutate(null, {
|
||||
onSuccess: async () => {
|
||||
touch('teams');
|
||||
onSave?.();
|
||||
onClose?.();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user