dashboard: fix toaster
This commit is contained in:
@@ -24,25 +24,20 @@ export function ListDashboards({ dashboards }: ListDashboardsProps) {
|
||||
const deletion = api.dashboard.delete.useMutation({
|
||||
onError: (error, variables) => {
|
||||
return handleErrorToastOptions({
|
||||
action: (
|
||||
<ToastAction
|
||||
altText="Force delete"
|
||||
onClick={() => {
|
||||
deletion.mutate({
|
||||
forceDelete: true,
|
||||
id: variables.id,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Force delete
|
||||
</ToastAction>
|
||||
),
|
||||
action: {
|
||||
label: 'Force delete',
|
||||
onClick: () => {
|
||||
deletion.mutate({
|
||||
forceDelete: true,
|
||||
id: variables.id,
|
||||
});
|
||||
},
|
||||
},
|
||||
})(error);
|
||||
},
|
||||
onSuccess() {
|
||||
router.refresh();
|
||||
toast({
|
||||
title: 'Success',
|
||||
toast('Success', {
|
||||
description: 'Dashboard deleted.',
|
||||
});
|
||||
},
|
||||
|
||||
@@ -25,13 +25,12 @@ export default function EditOrganization({
|
||||
const router = useRouter();
|
||||
|
||||
const { register, handleSubmit, formState, reset } = useForm<IForm>({
|
||||
defaultValues: organization,
|
||||
defaultValues: organization ?? undefined,
|
||||
});
|
||||
|
||||
const mutation = api.organization.update.useMutation({
|
||||
onSuccess(res) {
|
||||
toast({
|
||||
title: 'Organization updated',
|
||||
toast('Organization updated', {
|
||||
description: 'Your organization has been updated.',
|
||||
});
|
||||
reset(res);
|
||||
@@ -57,7 +56,7 @@ export default function EditOrganization({
|
||||
<InputWithLabel
|
||||
label="Name"
|
||||
{...register('name')}
|
||||
defaultValue={organization.name}
|
||||
defaultValue={organization?.name}
|
||||
/>
|
||||
</WidgetBody>
|
||||
</Widget>
|
||||
|
||||
@@ -27,8 +27,7 @@ export function InviteUser() {
|
||||
|
||||
const mutation = api.organization.inviteUser.useMutation({
|
||||
onSuccess() {
|
||||
toast({
|
||||
title: 'User invited!',
|
||||
toast('User invited!', {
|
||||
description: 'The user has been invited to the organization.',
|
||||
});
|
||||
reset();
|
||||
|
||||
@@ -35,8 +35,7 @@ export default function EditProfile({ profile }: EditProfileProps) {
|
||||
|
||||
const mutation = api.user.update.useMutation({
|
||||
onSuccess(res) {
|
||||
toast({
|
||||
title: 'Profile updated',
|
||||
toast('Profile updated', {
|
||||
description: 'Your profile has been updated.',
|
||||
});
|
||||
reset(res);
|
||||
|
||||
Reference in New Issue
Block a user