diff --git a/app/layout.tsx b/app/layout.tsx index b5718d6..22aa2d6 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -8,6 +8,7 @@ import Provider from "../utils/Provider"; import { Toaster as SonnerToaster } from "@/components/ui/sonner"; const inter = Inter({ subsets: ["latin"] }); import { Suspense } from "react"; +import ProgressBarProviders from "@/components/PrograssBar"; export const metadata: Metadata = { title: "عیون", @@ -24,7 +25,7 @@ export default function RootLayout({ {/* }>{children} */} - {children} + {children} diff --git a/components/AdminCategories.tsx b/components/AdminCategories.tsx index 6b37d9c..3b5f4b7 100644 --- a/components/AdminCategories.tsx +++ b/components/AdminCategories.tsx @@ -89,7 +89,7 @@ export default function AdminCategories() { queryKey: ["CategoriesList"], queryFn: () => GetAllCategories(), // refetchOnWindowFocus: false, - }); + }); // Edit const handleClickEdit = (id: string, title: string, description: string) => { @@ -149,14 +149,9 @@ export default function AdminCategories() { className: "!bg-green-500 !text-white", }); }, - onError: (error) => { - console.log(error); - console.log(error?.message); - - setOpenEdit(false); - - toast(error?.message, { - className: "!bg-red-500 !text-black", + onError: (err: any | string) => { + toast(<>{err.response.data.detail}, { + className: "!bg-red-500 !text-white", }); }, }); @@ -174,12 +169,9 @@ export default function AdminCategories() { className: "!bg-green-500 !text-white", }); }, - onError: (error) => { - console.log(error); - console.log(error?.message); - - toast(error?.message, { - className: "!bg-red-500 !text-black", + onError: (err: any | string) => { + toast(<>{err.response.data.detail}, { + className: "!bg-red-500 !text-white", }); }, }); @@ -200,14 +192,9 @@ export default function AdminCategories() { className: "!bg-green-500 !text-white", }); }, - onError: (error) => { - console.log(error); - console.log(error?.message); - - setOpenAdd(false); - - toast(error?.message, { - className: "!bg-red-500 !text-black", + onError: (err: any | string) => { + toast(<>{err.response.data.detail}, { + className: "!bg-red-500 !text-white", }); }, }); @@ -219,20 +206,20 @@ export default function AdminCategories() { title: data.titleCat, description: data.description, }, - }); + }); } function onSubmitAdd(data: AddCatFormValues) { AddCatMutation.mutate({ title: data.titleCategory, description: data.description, - }); + }); } return (
-
+
{/* 1 */} -
+
لیست دسته بندی ها
{/* 2 */} @@ -243,7 +230,7 @@ export default function AdminCategories() { - + بستن
@@ -335,7 +322,7 @@ export default function AdminCategories() {
-
+
@@ -343,7 +330,7 @@ export default function AdminCategories() {

تغییر دسته بندی

- + @@ -352,20 +339,20 @@ export default function AdminCategories() {
( - + عنوان @@ -377,12 +364,12 @@ export default function AdminCategories() { control={formEdit.control} name="description" render={({ field }) => ( - + توضیحات