diff --git a/resources/js/components/delete-user.tsx b/resources/js/components/delete-user.tsx index 213e76f..f8f960c 100644 --- a/resources/js/components/delete-user.tsx +++ b/resources/js/components/delete-user.tsx @@ -1,5 +1,6 @@ import { Form } from '@inertiajs/react'; import { useRef } from 'react'; +import { toast } from 'sonner'; import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController'; import Heading from '@/components/heading'; import InputError from '@/components/input-error'; @@ -59,7 +60,9 @@ export default function DeleteUser() { options={{ preserveScroll: true, }} - onError={() => passwordInput.current?.focus()} + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} resetOnSuccess className="space-y-6" > diff --git a/resources/js/components/form-dialog.tsx b/resources/js/components/form-dialog.tsx index e474904..f10b8a3 100644 --- a/resources/js/components/form-dialog.tsx +++ b/resources/js/components/form-dialog.tsx @@ -1,5 +1,3 @@ -import { Form } from '@inertiajs/react'; -import type { ReactNode } from 'react'; import { Button } from '@/components/ui/button'; import { Dialog, @@ -8,6 +6,9 @@ import { DialogHeader, DialogTitle, } from '@/components/ui/dialog'; +import { Form } from '@inertiajs/react'; +import type { ReactNode } from 'react'; +import { toast } from 'sonner'; type FormDialogProps = { open: boolean; @@ -20,11 +21,11 @@ type FormDialogProps = { submitLabel?: ReactNode; submittingLabel?: ReactNode; children: - | ReactNode - | ((ctx: { - errors: Record; - processing: boolean; - }) => ReactNode); + | ReactNode + | ((ctx: { + errors: Record; + processing: boolean; + }) => ReactNode); }; export function FormDialog({ @@ -46,6 +47,9 @@ export function FormDialog({ action={action} resetOnSuccess={resetOnSuccess} onSuccess={onSuccess} + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ errors, processing }) => ( <> diff --git a/resources/js/components/manage-two-factor.tsx b/resources/js/components/manage-two-factor.tsx index 84099d3..ad13cd2 100644 --- a/resources/js/components/manage-two-factor.tsx +++ b/resources/js/components/manage-two-factor.tsx @@ -1,6 +1,7 @@ import { Form } from '@inertiajs/react'; import { ShieldCheck } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; +import { toast } from 'sonner'; import Heading from '@/components/heading'; import TwoFactorRecoveryCodes from '@/components/two-factor-recovery-codes'; import TwoFactorSetupModal from '@/components/two-factor-setup-modal'; @@ -60,7 +61,12 @@ export default function ManageTwoFactor(props: Props) {

-
+ { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ processing }) => (
- + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ errors, processing }) => ( <>
diff --git a/resources/js/pages/admin/roles/edit.tsx b/resources/js/pages/admin/roles/edit.tsx index 27eacd0..6ff23ce 100644 --- a/resources/js/pages/admin/roles/edit.tsx +++ b/resources/js/pages/admin/roles/edit.tsx @@ -1,5 +1,6 @@ import { Form, Head, Link } from '@inertiajs/react'; import { ArrowLeft } from 'lucide-react'; +import { toast } from 'sonner'; import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; @@ -89,7 +90,12 @@ export default function RoleEdit({ role, permissions }: Props) {
- + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ errors, processing }) => ( <>
diff --git a/resources/js/pages/admin/settings/index.tsx b/resources/js/pages/admin/settings/index.tsx index 9017cb8..c3a06cd 100644 --- a/resources/js/pages/admin/settings/index.tsx +++ b/resources/js/pages/admin/settings/index.tsx @@ -1,6 +1,7 @@ import { Form, Head } from '@inertiajs/react'; import { Plus, Trash2 } from 'lucide-react'; import { useState } from 'react'; +import { toast } from 'sonner'; import { FileUpload } from '@/components/file-upload'; import InputError from '@/components/input-error'; import { PhoneNumberInput } from '@/components/phone-number-input'; @@ -94,7 +95,13 @@ function HomepageSettingsTab({ homepage }: HomepageSettingsTabProps) { } return ( - + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ processing, errors }) => (
@@ -522,6 +529,9 @@ export default function AdminSettings({ { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => (
@@ -643,6 +653,9 @@ export default function AdminSettings({ { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => (
@@ -731,6 +744,9 @@ export default function AdminSettings({ { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing }) => (
@@ -790,6 +806,9 @@ export default function AdminSettings({ { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => (
diff --git a/resources/js/pages/auth/confirm-password.tsx b/resources/js/pages/auth/confirm-password.tsx index 0489ce8..df40543 100644 --- a/resources/js/pages/auth/confirm-password.tsx +++ b/resources/js/pages/auth/confirm-password.tsx @@ -1,4 +1,5 @@ import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import { index as confirmOptions, store as confirmStore, @@ -26,7 +27,13 @@ export default function ConfirmPassword() { separator="Or confirm with password" /> - + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ processing, errors }) => (
diff --git a/resources/js/pages/auth/forgot-password.tsx b/resources/js/pages/auth/forgot-password.tsx index 25c81b9..49ef047 100644 --- a/resources/js/pages/auth/forgot-password.tsx +++ b/resources/js/pages/auth/forgot-password.tsx @@ -1,5 +1,6 @@ // Components import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import { LoaderCircle } from 'lucide-react'; import InputError from '@/components/input-error'; import TextLink from '@/components/text-link'; @@ -21,7 +22,12 @@ export default function ForgotPassword({ status }: { status?: string }) { )}
- + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ processing, errors }) => ( <>
diff --git a/resources/js/pages/auth/login.tsx b/resources/js/pages/auth/login.tsx index cf10840..69b3fb5 100644 --- a/resources/js/pages/auth/login.tsx +++ b/resources/js/pages/auth/login.tsx @@ -1,4 +1,5 @@ import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import InputError from '@/components/input-error'; import PasswordInput from '@/components/password-input'; import { Button } from '@/components/ui/button'; @@ -17,6 +18,9 @@ export default function Login() { action={store()} resetOnSuccess={['password']} className="flex flex-col gap-6" + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => ( <> diff --git a/resources/js/pages/auth/register.tsx b/resources/js/pages/auth/register.tsx index ce766ef..b165b69 100644 --- a/resources/js/pages/auth/register.tsx +++ b/resources/js/pages/auth/register.tsx @@ -1,4 +1,5 @@ import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import InputError from '@/components/input-error'; import PasswordInput from '@/components/password-input'; import TextLink from '@/components/text-link'; @@ -22,6 +23,9 @@ export default function Register({ passwordRules }: Props) { resetOnSuccess={['password', 'password_confirmation']} disableWhileProcessing className="flex flex-col gap-6" + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => ( <> diff --git a/resources/js/pages/auth/reset-password.tsx b/resources/js/pages/auth/reset-password.tsx index 8b762c3..6fa23dd 100644 --- a/resources/js/pages/auth/reset-password.tsx +++ b/resources/js/pages/auth/reset-password.tsx @@ -1,4 +1,5 @@ import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import InputError from '@/components/input-error'; import PasswordInput from '@/components/password-input'; import { Button } from '@/components/ui/button'; @@ -22,6 +23,9 @@ export default function ResetPassword({ token, email, passwordRules }: Props) { {...update.form()} transform={(data) => ({ ...data, token, email })} resetOnSuccess={['password', 'password_confirmation']} + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ processing, errors }) => (
diff --git a/resources/js/pages/auth/two-factor-challenge.tsx b/resources/js/pages/auth/two-factor-challenge.tsx index 3cddec3..a41ddcc 100644 --- a/resources/js/pages/auth/two-factor-challenge.tsx +++ b/resources/js/pages/auth/two-factor-challenge.tsx @@ -1,6 +1,7 @@ import { Form, Head, setLayoutProps } from '@inertiajs/react'; import { REGEXP_ONLY_DIGITS } from 'input-otp'; import { useMemo, useState } from 'react'; +import { toast } from 'sonner'; import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -59,6 +60,9 @@ export default function TwoFactorChallenge() { className="space-y-4" resetOnError resetOnSuccess={!showRecoveryInput} + onError={() => { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} > {({ errors, processing, clearErrors }) => ( <> diff --git a/resources/js/pages/auth/verify-email.tsx b/resources/js/pages/auth/verify-email.tsx index a6fee14..5b1aa16 100644 --- a/resources/js/pages/auth/verify-email.tsx +++ b/resources/js/pages/auth/verify-email.tsx @@ -1,5 +1,6 @@ // Components import { Form, Head } from '@inertiajs/react'; +import { toast } from 'sonner'; import TextLink from '@/components/text-link'; import { Button } from '@/components/ui/button'; import { Spinner } from '@/components/ui/spinner'; @@ -18,7 +19,13 @@ export default function VerifyEmail({ status }: { status?: string }) {
)} - + { + toast.error('Terjadi kesalahan saat menyimpan data. Silakan periksa kembali input Anda.'); + }} + > {({ processing }) => ( <>