This commit is contained in:
@@ -69,7 +69,7 @@ export const createCustomer = async (params: CreateCustomerType) => {
|
|||||||
|
|
||||||
**List** — header + optional filters + `PageLoading` while pending + `<table>` with `Td` + `Pagination`. Link actions via `Pages.{feature}.*`.
|
**List** — header + optional filters + `PageLoading` while pending + `<table>` with `Td` + `Pagination`. Link actions via `Pages.{feature}.*`.
|
||||||
|
|
||||||
**Create / Update** — Formik + Yup validation, `toast.success(t('success'))` on success, `toast.error(error.response?.data?.error.message[0])` on error (`ErrorType` from `src/helpers/types.ts`). Navigate back to list with `useNavigate()` + `Pages.*`.
|
**Create / Update** — Formik + Yup validation, `toast(t('success'), 'success')` on success, `toast(error.response?.data?.error.message[0], 'error')` on error (`ErrorType` from `src/helpers/types.ts`). Import `toast` from `src/components/Toast`. Navigate back to list with `useNavigate()` + `Pages.*`.
|
||||||
|
|
||||||
**Delete** — small component using `ModalConfrim` + mutation hook; call `refetch()` or rely on query invalidation.
|
**Delete** — small component using `ModalConfrim` + mutation hook; call `refetch()` or rely on query invalidation.
|
||||||
|
|
||||||
|
|||||||
Generated
-14
@@ -32,7 +32,6 @@
|
|||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
"react-router-dom": "^7.1.0",
|
"react-router-dom": "^7.1.0",
|
||||||
"react-spinners": "^0.15.0",
|
"react-spinners": "^0.15.0",
|
||||||
"react-toastify": "^11.0.2",
|
|
||||||
"swiper": "^11.2.1",
|
"swiper": "^11.2.1",
|
||||||
"tailwind-merge": "^2.5.5",
|
"tailwind-merge": "^2.5.5",
|
||||||
"vite-plugin-pwa": "^0.21.1",
|
"vite-plugin-pwa": "^0.21.1",
|
||||||
@@ -7298,19 +7297,6 @@
|
|||||||
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-toastify": {
|
|
||||||
"version": "11.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-11.0.2.tgz",
|
|
||||||
"integrity": "sha512-GjHuGaiXMvbls3ywqv8XdWONwrcO4DXCJIY1zVLkHU73gEElKvTTXNI5Vom3s/k/M8hnkrfsqgBSX3OwmlonbA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"clsx": "^2.1.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^18 || ^19",
|
|
||||||
"react-dom": "^18 || ^19"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/read-cache": {
|
"node_modules/read-cache": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
"react-router-dom": "^7.1.0",
|
"react-router-dom": "^7.1.0",
|
||||||
"react-spinners": "^0.15.0",
|
"react-spinners": "^0.15.0",
|
||||||
"react-toastify": "^11.0.2",
|
|
||||||
"swiper": "^11.2.1",
|
"swiper": "^11.2.1",
|
||||||
"tailwind-merge": "^2.5.5",
|
"tailwind-merge": "^2.5.5",
|
||||||
"vite-plugin-pwa": "^0.21.1",
|
"vite-plugin-pwa": "^0.21.1",
|
||||||
|
|||||||
+41
-54
@@ -1,30 +1,30 @@
|
|||||||
import { FC, useEffect, useState } from 'react'
|
import { QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import i18next from "i18next";
|
||||||
import 'swiper/swiper-bundle.css';
|
|
||||||
import 'rc-rate/assets/index.css';
|
|
||||||
import "quill/dist/quill.snow.css";
|
import "quill/dist/quill.snow.css";
|
||||||
import "react-multi-date-picker/styles/layouts/mobile.css"
|
import "rc-rate/assets/index.css";
|
||||||
import i18next from 'i18next'
|
import { FC, useEffect, useState } from "react";
|
||||||
import { I18nextProvider } from 'react-i18next'
|
import { I18nextProvider } from "react-i18next";
|
||||||
import { QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
import "react-multi-date-picker/styles/layouts/mobile.css";
|
||||||
import { ToastContainer } from 'react-toastify'
|
import { BrowserRouter } from "react-router-dom";
|
||||||
import FaJson from './langs/fa.json'
|
import "swiper/swiper-bundle.css";
|
||||||
import { IApiErrorRepsonse } from './types/error.types'
|
import ToastContainer from "./components/Toast";
|
||||||
import MainRouter from './router/Main'
|
import { Pages } from "./config/Pages";
|
||||||
import AuthRouter from './router/Auth'
|
import { getRefreshToken, getToken, removeRefreshToken, removeToken, setRefreshToken, setToken } from "./config/func";
|
||||||
import { Pages } from './config/Pages'
|
import FaJson from "./langs/fa.json";
|
||||||
import { getRefreshToken, setToken, setRefreshToken, removeToken, removeRefreshToken, getToken } from './config/func';
|
import { refreshToken } from "./pages/auth/service/AuthService";
|
||||||
import { refreshToken } from './pages/auth/service/AuthService';
|
import AuthRouter from "./router/Auth";
|
||||||
|
import MainRouter from "./router/Main";
|
||||||
|
import { IApiErrorRepsonse } from "./types/error.types";
|
||||||
|
|
||||||
i18next.init({
|
i18next.init({
|
||||||
interpolation: { escapeValue: false },
|
interpolation: { escapeValue: false },
|
||||||
lng: 'fa',
|
lng: "fa",
|
||||||
resources: {
|
resources: {
|
||||||
fa: {
|
fa: {
|
||||||
global: FaJson
|
global: FaJson,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@@ -40,7 +40,7 @@ const queryClient = new QueryClient({
|
|||||||
// Use a flag to track if refresh is in progress
|
// Use a flag to track if refresh is in progress
|
||||||
if (window.isRefreshingToken) {
|
if (window.isRefreshingToken) {
|
||||||
// Wait for the refresh to complete
|
// Wait for the refresh to complete
|
||||||
await new Promise(resolve => {
|
await new Promise((resolve) => {
|
||||||
const checkComplete = setInterval(() => {
|
const checkComplete = setInterval(() => {
|
||||||
if (!window.isRefreshingToken) {
|
if (!window.isRefreshingToken) {
|
||||||
clearInterval(checkComplete);
|
clearInterval(checkComplete);
|
||||||
@@ -56,7 +56,7 @@ const queryClient = new QueryClient({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const refreshTokenValue = await getRefreshToken();
|
const refreshTokenValue = await getRefreshToken();
|
||||||
const { data } = await refreshToken({ refreshToken: refreshTokenValue || '' });
|
const { data } = await refreshToken({ refreshToken: refreshTokenValue || "" });
|
||||||
|
|
||||||
if (data?.accessToken?.token) {
|
if (data?.accessToken?.token) {
|
||||||
// Save the new token
|
// Save the new token
|
||||||
@@ -71,67 +71,54 @@ const queryClient = new QueryClient({
|
|||||||
queryClient.invalidateQueries();
|
queryClient.invalidateQueries();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid token response');
|
throw new Error("Invalid token response");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
window.isRefreshingToken = false;
|
window.isRefreshingToken = false;
|
||||||
}
|
}
|
||||||
} catch (refreshError: unknown) {
|
} catch (refreshError: unknown) {
|
||||||
console.error('Token refresh failed:', refreshError);
|
console.error("Token refresh failed:", refreshError);
|
||||||
// Clear tokens and redirect to login
|
// Clear tokens and redirect to login
|
||||||
await removeToken();
|
await removeToken();
|
||||||
await removeRefreshToken();
|
await removeRefreshToken();
|
||||||
window.location.href = '/auth/login';
|
window.location.href = "/auth/login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
retry: false
|
retry: false,
|
||||||
// staleTime: 86400000 // 1 day in milliseconds
|
// staleTime: 86400000 // 1 day in milliseconds
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const App: FC = () => {
|
const App: FC = () => {
|
||||||
|
const [isLogin, setIsLogin] = useState<"checking" | "isLogin" | "isNotLogin">("checking");
|
||||||
const [isLogin, setIsLogin] = useState<'checking' | 'isLogin' | 'isNotLogin'>('checking')
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const token = getToken()
|
const token = getToken();
|
||||||
if (token) {
|
if (token) {
|
||||||
setIsLogin('isLogin')
|
setIsLogin("isLogin");
|
||||||
} else {
|
} else {
|
||||||
setIsLogin('isNotLogin')
|
setIsLogin("isNotLogin");
|
||||||
if (window.location.href.split('auth').length === 1) {
|
if (window.location.href.split("auth").length === 1) {
|
||||||
window.location.href = Pages.auth.login
|
window.location.href = Pages.auth.login;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, []);
|
||||||
}, [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<I18nextProvider i18n={i18next}>
|
<I18nextProvider i18n={i18next}>
|
||||||
{
|
{isLogin === "checking" ? null : isLogin === "isLogin" ? <MainRouter /> : <AuthRouter />}
|
||||||
isLogin === 'checking' ?
|
|
||||||
null
|
|
||||||
:
|
|
||||||
isLogin === 'isLogin' ?
|
|
||||||
<MainRouter />
|
|
||||||
:
|
|
||||||
<AuthRouter />
|
|
||||||
}
|
|
||||||
<ToastContainer />
|
<ToastContainer />
|
||||||
</I18nextProvider>
|
</I18nextProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default App
|
export default App;
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
'use client'
|
||||||
|
import { CloseCircle, InfoCircle, TickCircle } from 'iconsax-react';
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
interface Toast {
|
||||||
|
id: string;
|
||||||
|
message: string;
|
||||||
|
type?: 'success' | 'error' | 'info';
|
||||||
|
}
|
||||||
|
|
||||||
|
let addToast: (toast: Toast) => void = () => {};
|
||||||
|
|
||||||
|
const ToastContainer: React.FC = () => {
|
||||||
|
const [toasts, setToasts] = useState<Toast[]>([]);
|
||||||
|
|
||||||
|
const showToast = (toastItem: Toast) => {
|
||||||
|
setToasts((prev) => [...prev, toastItem]);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
setToasts((prev) => prev.filter((t) => t.id !== toastItem.id));
|
||||||
|
}, 3000);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
addToast = showToast;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="fixed top-4 text-sm right-0 left-0 mx-auto w-fit z-50 flex flex-col gap-2">
|
||||||
|
{toasts.map((toastItem) => (
|
||||||
|
<div
|
||||||
|
key={toastItem.id}
|
||||||
|
className="px-4 flex items-center gap-2 backdrop-blur-2xl h-16 min-w-[300px] rounded-2xl shadow-md transition-transform bg-white/70 text-black"
|
||||||
|
>
|
||||||
|
{toastItem.type === 'success' ? (
|
||||||
|
<TickCircle className="size-5" color="green" />
|
||||||
|
) : toastItem.type === 'error' ? (
|
||||||
|
<CloseCircle className="size-5" color="red" />
|
||||||
|
) : (
|
||||||
|
<InfoCircle className="size-5" color="blue" />
|
||||||
|
)}
|
||||||
|
{toastItem.message}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toast = (message: string | undefined, type: 'success' | 'error' | 'info' = 'info') => {
|
||||||
|
if (!message) return;
|
||||||
|
addToast({ id: `${Date.now()}-${Math.random()}`, message, type });
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ToastContainer;
|
||||||
@@ -13,7 +13,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
|||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { useCreateAds } from './hooks/useAdsData'
|
import { useCreateAds } from './hooks/useAdsData'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { clx } from '../../helpers/utils'
|
import { clx } from '../../helpers/utils'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -54,21 +54,21 @@ const CreateAd: FC = () => {
|
|||||||
values.imageUrl = data?.data?.url
|
values.imageUrl = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
createAds.mutate(values, {
|
createAds.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.ads.list)
|
navigate(Pages.ads.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('ads.file_error'))
|
toast(t('ads.file_error'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
|||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { useGetDetailAds, useUpdateAds } from './hooks/useAdsData'
|
import { useGetDetailAds, useUpdateAds } from './hooks/useAdsData'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { clx } from '../../helpers/utils'
|
import { clx } from '../../helpers/utils'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -56,18 +56,18 @@ const UpdateAds: FC = () => {
|
|||||||
values.imageUrl = data?.data?.url
|
values.imageUrl = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAds.mutate(values, {
|
updateAds.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.ads.list)
|
navigate(Pages.ads.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import * as Yup from 'yup'
|
|||||||
import { ServiceItemType } from '../service/types/ServiceTypes'
|
import { ServiceItemType } from '../service/types/ServiceTypes'
|
||||||
import { useCreateAnnoncement, useGetCustomersService } from './hooks/useAnnoncementData'
|
import { useCreateAnnoncement, useGetCustomersService } from './hooks/useAnnoncementData'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -57,11 +57,11 @@ const Create: FC = () => {
|
|||||||
createAnnoncement.mutate(values, {
|
createAnnoncement.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.announcement.list)
|
navigate(Pages.announcement.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Add, Edit, Trash } from 'iconsax-react'
|
|||||||
import Td from '../../components/Td'
|
import Td from '../../components/Td'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import Pagination from '../../components/Pagination'
|
import Pagination from '../../components/Pagination'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
|
|
||||||
const AnnouncementtList: FC = () => {
|
const AnnouncementtList: FC = () => {
|
||||||
@@ -22,11 +22,11 @@ const AnnouncementtList: FC = () => {
|
|||||||
const handleDelete = (id: string) => {
|
const handleDelete = (id: string) => {
|
||||||
deleteAnnoncement.mutate(id, {
|
deleteAnnoncement.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
getAnnoncements.refetch()
|
getAnnoncements.refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import * as Yup from 'yup'
|
|||||||
import { ServiceItemType } from '../service/types/ServiceTypes'
|
import { ServiceItemType } from '../service/types/ServiceTypes'
|
||||||
import { useGetAnnoncementDetail, useGetCustomersService, useUpdateAnnoncement } from './hooks/useAnnoncementData'
|
import { useGetAnnoncementDetail, useGetCustomersService, useUpdateAnnoncement } from './hooks/useAnnoncementData'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -59,11 +59,11 @@ const Update: FC = () => {
|
|||||||
updateAnnoncement.mutate(values, {
|
updateAnnoncement.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.announcement.list)
|
navigate(Pages.announcement.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Error from '../../../components/Error'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { isEmail } from '../../../config/func'
|
import { isEmail } from '../../../config/func'
|
||||||
import { useCheckHasAccount, useLoginWithOtp } from '../hooks/useAuthData'
|
import { useCheckHasAccount, useLoginWithOtp } from '../hooks/useAuthData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
const LoginStep1: FC = () => {
|
const LoginStep1: FC = () => {
|
||||||
@@ -35,7 +35,7 @@ const LoginStep1: FC = () => {
|
|||||||
setStepLogin(2)
|
setStepLogin(2)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -43,10 +43,10 @@ const LoginStep1: FC = () => {
|
|||||||
loginWithOtp.mutate({ phone: values.phone_email }, {
|
loginWithOtp.mutate({ phone: values.phone_email }, {
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
setStepLogin(2)
|
setStepLogin(2)
|
||||||
toast.success(t('auth.otp_sent'))
|
toast(t('auth.otp_sent'), 'success')
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useCountDown } from '../../../hooks/useCountDown'
|
|||||||
import { Pages } from '../../../config/Pages'
|
import { Pages } from '../../../config/Pages'
|
||||||
import { useOtpVerify } from '../hooks/useAuthData'
|
import { useOtpVerify } from '../hooks/useAuthData'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { setToken, setRefreshToken } from '../../../config/func'
|
import { setToken, setRefreshToken } from '../../../config/func'
|
||||||
|
|
||||||
const LoginStep2: FC = () => {
|
const LoginStep2: FC = () => {
|
||||||
@@ -42,7 +42,7 @@ const LoginStep2: FC = () => {
|
|||||||
window.location.href = Pages.dashboard
|
window.location.href = Pages.dashboard
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { Link } from 'react-router-dom'
|
|||||||
import { Pages } from '../../../config/Pages'
|
import { Pages } from '../../../config/Pages'
|
||||||
import ArrowLeftIcon from '../../../assets/images/arrow-left.svg'
|
import ArrowLeftIcon from '../../../assets/images/arrow-left.svg'
|
||||||
import { useLoginWithPassword } from '../hooks/useAuthData'
|
import { useLoginWithPassword } from '../hooks/useAuthData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { setRefreshToken } from '../../../config/func'
|
import { setRefreshToken } from '../../../config/func'
|
||||||
import { setToken } from '../../../config/func'
|
import { setToken } from '../../../config/func'
|
||||||
@@ -39,7 +39,7 @@ const LoginStep3: FC = () => {
|
|||||||
window.location.href = Pages.dashboard
|
window.location.href = Pages.dashboard
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useAuthStore } from '../store/AuthStore'
|
|||||||
import Error from '../../../components/Error'
|
import Error from '../../../components/Error'
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { useCheckHasAccountRegister, useLoginWithOtp } from '../hooks/useAuthData'
|
import { useCheckHasAccountRegister, useLoginWithOtp } from '../hooks/useAuthData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
const RegisterStep1: FC = () => {
|
const RegisterStep1: FC = () => {
|
||||||
@@ -33,7 +33,7 @@ const RegisterStep1: FC = () => {
|
|||||||
setStepLogin(2)
|
setStepLogin(2)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import DatePickerComponent from '../../../components/DatePicker'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { useRegister } from '../hooks/useAuthData'
|
import { useRegister } from '../hooks/useAuthData'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { Pages } from '../../../config/Pages'
|
import { Pages } from '../../../config/Pages'
|
||||||
|
|
||||||
const RegisterStep2: FC = () => {
|
const RegisterStep2: FC = () => {
|
||||||
@@ -52,7 +52,7 @@ const RegisterStep2: FC = () => {
|
|||||||
window.location.href = Pages.dashboard
|
window.location.href = Pages.dashboard
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import * as Yup from 'yup'
|
|||||||
import Textarea from '../../components/Textarea'
|
import Textarea from '../../components/Textarea'
|
||||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import UpdateCategory from './components/UpdateCategory'
|
import UpdateCategory from './components/UpdateCategory'
|
||||||
const BlogCategory: FC = () => {
|
const BlogCategory: FC = () => {
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ const BlogCategory: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
toast.error('فایل را انتخاب کنید')
|
toast('فایل را انتخاب کنید', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
@@ -51,7 +51,7 @@ const BlogCategory: FC = () => {
|
|||||||
|
|
||||||
createBlogCategory.mutateAsync(values, {
|
createBlogCategory.mutateAsync(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('دسته بندی با موفقیت ثبت شد')
|
toast('دسته بندی با موفقیت ثبت شد', 'success')
|
||||||
setFile(undefined)
|
setFile(undefined)
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
getBlogCategories.refetch()
|
getBlogCategories.refetch()
|
||||||
@@ -106,7 +106,7 @@ const BlogCategory: FC = () => {
|
|||||||
<Trash size={20} color='red' onClick={() => {
|
<Trash size={20} color='red' onClick={() => {
|
||||||
deleteBlogCategory.mutateAsync(item.id, {
|
deleteBlogCategory.mutateAsync(item.id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('دسته بندی با موفقیت حذف شد')
|
toast('دسته بندی با موفقیت حذف شد', 'success')
|
||||||
getBlogCategories.refetch()
|
getBlogCategories.refetch()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { BlogCommentType } from './types/BlogTypes'
|
|||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import { CloseCircle, TickCircle } from 'iconsax-react'
|
import { CloseCircle, TickCircle } from 'iconsax-react'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
const Comments: FC = () => {
|
const Comments: FC = () => {
|
||||||
const { t } = useTranslation('global')
|
const { t } = useTranslation('global')
|
||||||
const getBlogComments = useGetBlogComments()
|
const getBlogComments = useGetBlogComments()
|
||||||
@@ -17,7 +17,7 @@ const Comments: FC = () => {
|
|||||||
getBlogComments.refetch()
|
getBlogComments.refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
|||||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||||
import QuillEditor from '../../components/QuillEditor'
|
import QuillEditor from '../../components/QuillEditor'
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
@@ -57,7 +57,7 @@ const CreateBlog: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
toast.error(t('errors.required'))
|
toast(t('errors.required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,11 +88,11 @@ const CreateBlog: FC = () => {
|
|||||||
createBlog.mutate(values, {
|
createBlog.mutate(values, {
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
setIsSaved(true)
|
setIsSaved(true)
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.blog.list)
|
navigate(Pages.blog.list)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
|||||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||||
import QuillEditor from '../../components/QuillEditor'
|
import QuillEditor from '../../components/QuillEditor'
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
@@ -87,11 +87,11 @@ const UpdateBlog: FC = () => {
|
|||||||
updateBlog.mutate({ id: id || '', params: values }, {
|
updateBlog.mutate({ id: id || '', params: values }, {
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
setIsSaved(true)
|
setIsSaved(true)
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.blog.list)
|
navigate(Pages.blog.list)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import UploadBox from '../../../components/UploadBox'
|
|||||||
import { useSingleUpload } from '../../service/hooks/useServiceData'
|
import { useSingleUpload } from '../../service/hooks/useServiceData'
|
||||||
import SwitchComponent from '../../../components/Switch'
|
import SwitchComponent from '../../../components/Switch'
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string
|
id: string
|
||||||
@@ -42,12 +42,12 @@ const UpdateCategory: FC<Props> = ({ id }) => {
|
|||||||
}
|
}
|
||||||
updateBlogCategory.mutateAsync({ id: id, params: values }, {
|
updateBlogCategory.mutateAsync({ id: id, params: values }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('دسته بندی با موفقیت ویرایش شد')
|
toast('دسته بندی با موفقیت ویرایش شد', 'success')
|
||||||
setIsOpen(false)
|
setIsOpen(false)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useCreateBank } from './hooks/useCardBankData'
|
|||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const CreateBankCard: FC = () => {
|
const CreateBankCard: FC = () => {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ const CreateBankCard: FC = () => {
|
|||||||
navigate(Pages.cardBank.list)
|
navigate(Pages.cardBank.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useGetCardBankDetail, useUpdateBank } from './hooks/useCardBankData'
|
|||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const EditBankCard: FC = () => {
|
const EditBankCard: FC = () => {
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ const EditBankCard: FC = () => {
|
|||||||
navigate(Pages.cardBank.list)
|
navigate(Pages.cardBank.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useFormik } from 'formik';
|
|||||||
import { CreateCustomerType, ProvinesItemType } from './types/CustomerTypes';
|
import { CreateCustomerType, ProvinesItemType } from './types/CustomerTypes';
|
||||||
import { useCreateCustomer, useGetCities, useGetProvines } from './hooks/useCustomerData';
|
import { useCreateCustomer, useGetCities, useGetProvines } from './hooks/useCustomerData';
|
||||||
import PageLoading from '../../components/PageLoading';
|
import PageLoading from '../../components/PageLoading';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types';
|
import { ErrorType } from '../../helpers/types';
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData';
|
import { useSingleUpload } from '../service/hooks/useServiceData';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
@@ -32,11 +32,11 @@ const AddCustomer: FC = () => {
|
|||||||
const handleCreateCustomer = (values: CreateCustomerType) => {
|
const handleCreateCustomer = (values: CreateCustomerType) => {
|
||||||
createCustomer.mutate(values, {
|
createCustomer.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.customer.list)
|
navigate(Pages.customer.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ const AddCustomer: FC = () => {
|
|||||||
values.profilePic = data?.data?.url
|
values.profilePic = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useFormik } from 'formik';
|
|||||||
import { CreateCustomerType, ProvinesItemType } from './types/CustomerTypes';
|
import { CreateCustomerType, ProvinesItemType } from './types/CustomerTypes';
|
||||||
import { useGetCities, useGetCustomerDetail, useGetProvines, useUpdateCustomer } from './hooks/useCustomerData';
|
import { useGetCities, useGetCustomerDetail, useGetProvines, useUpdateCustomer } from './hooks/useCustomerData';
|
||||||
import PageLoading from '../../components/PageLoading';
|
import PageLoading from '../../components/PageLoading';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types';
|
import { ErrorType } from '../../helpers/types';
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData';
|
import { useSingleUpload } from '../service/hooks/useServiceData';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
@@ -34,11 +34,11 @@ const UpdateCustomer: FC = () => {
|
|||||||
const handleUpdateCustomer = (values: CreateCustomerType) => {
|
const handleUpdateCustomer = (values: CreateCustomerType) => {
|
||||||
updateCustomer.mutate(values, {
|
updateCustomer.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.customer.list)
|
navigate(Pages.customer.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ const UpdateCustomer: FC = () => {
|
|||||||
values.profilePic = data?.data?.url
|
values.profilePic = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as Yup from 'yup'
|
|||||||
import { useGetAllServices } from '../service/hooks/useServiceData'
|
import { useGetAllServices } from '../service/hooks/useServiceData'
|
||||||
import { ServiceItemType } from '../service/types/ServiceTypes'
|
import { ServiceItemType } from '../service/types/ServiceTypes'
|
||||||
import CheckBoxComponent from '../../components/CheckBoxComponent'
|
import CheckBoxComponent from '../../components/CheckBoxComponent'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useCreateDiscount } from './hooks/useDiscountData'
|
import { useCreateDiscount } from './hooks/useDiscountData'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -64,11 +64,11 @@ const CreateDiscount: FC = () => {
|
|||||||
}
|
}
|
||||||
createDiscount.mutate(params, {
|
createDiscount.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.discount.list)
|
navigate(Pages.discount.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import moment from 'moment-jalaali'
|
|||||||
import ToggleStatusDiscount from './components/ToggleStatusDiscount'
|
import ToggleStatusDiscount from './components/ToggleStatusDiscount'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
import { NumberFormat } from '../../config/func'
|
import { NumberFormat } from '../../config/func'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
|
|
||||||
const DiscountList: FC = () => {
|
const DiscountList: FC = () => {
|
||||||
@@ -26,10 +26,10 @@ const DiscountList: FC = () => {
|
|||||||
deleteDiscount.mutate(id, {
|
deleteDiscount.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
getDiscounts.refetch()
|
getDiscounts.refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as Yup from 'yup'
|
|||||||
import { useGetAllServices } from '../service/hooks/useServiceData'
|
import { useGetAllServices } from '../service/hooks/useServiceData'
|
||||||
import { ServiceItemType } from '../service/types/ServiceTypes'
|
import { ServiceItemType } from '../service/types/ServiceTypes'
|
||||||
import CheckBoxComponent from '../../components/CheckBoxComponent'
|
import CheckBoxComponent from '../../components/CheckBoxComponent'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useGetDiscountDetail, useUpdateDiscount } from './hooks/useDiscountData'
|
import { useGetDiscountDetail, useUpdateDiscount } from './hooks/useDiscountData'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -66,11 +66,11 @@ const UpdateDiscount: FC = () => {
|
|||||||
}
|
}
|
||||||
updateDiscount.mutate({ id: id || '', params }, {
|
updateDiscount.mutate({ id: id || '', params }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.discount.list)
|
navigate(Pages.discount.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../../components/Td'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { GroupIconType } from '../types/Types'
|
import { GroupIconType } from '../types/Types'
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@ const GroupIconList: FC = () => {
|
|||||||
deleteGroupIcon.mutate(id, {
|
deleteGroupIcon.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../../components/Td'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { IconType } from '../types/Types'
|
import { IconType } from '../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
@@ -30,10 +30,10 @@ const IconsList: FC = () => {
|
|||||||
deleteIcon.mutate(id, {
|
deleteIcon.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import DefaulModal from '../../../../components/DefaulModal'
|
|||||||
import Input from '../../../../components/Input'
|
import Input from '../../../../components/Input'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateGroupIcon } from '../../hooks/useIconData'
|
import { useCreateGroupIcon } from '../../hooks/useIconData'
|
||||||
import { CreateGroupIconType } from '../../types/Types'
|
import { CreateGroupIconType } from '../../types/Types'
|
||||||
@@ -34,11 +34,11 @@ const CreateGroupIcon: FC<CreateGroupIconProps> = ({ open, close, onSuccess }) =
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
close()
|
close()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
onSuccess?.()
|
onSuccess?.()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import UploadBox from '../../../../components/UploadBox'
|
|||||||
import Select from '../../../../components/Select'
|
import Select from '../../../../components/Select'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateIcon, useGetGroupIcons } from '../../hooks/useIconData'
|
import { useCreateIcon, useGetGroupIcons } from '../../hooks/useIconData'
|
||||||
import { useMultiUpload } from '../../../service/hooks/useServiceData'
|
import { useMultiUpload } from '../../../service/hooks/useServiceData'
|
||||||
@@ -44,7 +44,7 @@ const CreateIcon: FC<CreateIconProps> = ({ open, close, onSuccess }) => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
toast.error(t('errors.required'))
|
toast(t('errors.required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,11 +67,11 @@ const CreateIcon: FC<CreateIconProps> = ({ open, close, onSuccess }) => {
|
|||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
setFiles([])
|
setFiles([])
|
||||||
close()
|
close()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
onSuccess?.()
|
onSuccess?.()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const err = error as ErrorType
|
const err = error as ErrorType
|
||||||
toast.error(err.response?.data?.error?.message?.[0])
|
toast(err.response?.data?.error?.message?.[0], 'error')
|
||||||
} finally {
|
} finally {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Td from '../../../components/Td'
|
|||||||
import { ShopType, ShopsResponse } from '../types/Types'
|
import { ShopType, ShopsResponse } from '../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import { Edit } from 'iconsax-react'
|
import { Edit } from 'iconsax-react'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import ShopAdminsModal from './components/ShopAdminsModal'
|
import ShopAdminsModal from './components/ShopAdminsModal'
|
||||||
import Pagination from '../../../components/Pagination'
|
import Pagination from '../../../components/Pagination'
|
||||||
@@ -56,11 +56,11 @@ const ShopsList: FC = () => {
|
|||||||
const handleDeleteShop = (shopId: string) => {
|
const handleDeleteShop = (shopId: string) => {
|
||||||
deleteShop.mutate(shopId, {
|
deleteShop.mutate(shopId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('فروشگاه با موفقیت حذف شد')
|
toast('فروشگاه با موفقیت حذف شد', 'success')
|
||||||
queryClient.invalidateQueries({ queryKey: ['shops'] })
|
queryClient.invalidateQueries({ queryKey: ['shops'] })
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
toast.error('خطا در حذف فروشگاه')
|
toast('خطا در حذف فروشگاه', 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import SwitchComponent from '../../../components/Switch'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import DatePickerComponent from '../../../components/DatePicker'
|
import DatePickerComponent from '../../../components/DatePicker'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { Pages } from '../../../config/Pages'
|
import { Pages } from '../../../config/Pages'
|
||||||
@@ -57,13 +57,13 @@ const UpdateShop: FC = () => {
|
|||||||
{ id, params },
|
{ id, params },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
queryClient.invalidateQueries({ queryKey: ['shops'] })
|
queryClient.invalidateQueries({ queryKey: ['shops'] })
|
||||||
queryClient.invalidateQueries({ queryKey: ['shop', id] })
|
queryClient.invalidateQueries({ queryKey: ['shop', id] })
|
||||||
navigate(Pages.dkala.shops.list)
|
navigate(Pages.dkala.shops.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message?.[0] || 'خطا در بروزرسانی فروشگاه')
|
toast(error.response?.data?.error?.message?.[0] || 'خطا در بروزرسانی فروشگاه', 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Button from '../../../../components/Button'
|
|||||||
import { useAddAdminShop, useGetSystemRoles } from '../../hooks/useIconData'
|
import { useAddAdminShop, useGetSystemRoles } from '../../hooks/useIconData'
|
||||||
import { SystemRoleType } from '../../types/Types'
|
import { SystemRoleType } from '../../types/Types'
|
||||||
import { ErrorType } from '../../../../helpers/types'
|
import { ErrorType } from '../../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
|
|
||||||
interface AddShopAdminFormProps {
|
interface AddShopAdminFormProps {
|
||||||
@@ -46,13 +46,13 @@ const AddShopAdminForm: FC<AddShopAdminFormProps> = ({
|
|||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
addAdmin(values, {
|
addAdmin(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
onSuccess()
|
onSuccess()
|
||||||
onClose()
|
onClose()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Td from '../../../../components/Td'
|
|||||||
import { ShopAdminType } from '../../types/Types'
|
import { ShopAdminType } from '../../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import TrashWithConfrim from '../../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { ErrorType } from '../../../../helpers/types'
|
import { ErrorType } from '../../../../helpers/types'
|
||||||
import Button from '../../../../components/Button'
|
import Button from '../../../../components/Button'
|
||||||
import AddShopAdminForm from './AddShopAdminForm'
|
import AddShopAdminForm from './AddShopAdminForm'
|
||||||
@@ -31,10 +31,10 @@ const ShopAdminsModal: FC<ShopAdminsModalProps> = ({ open, close, shopId }) => {
|
|||||||
deleteAdmin({ shopId, adminId }, {
|
deleteAdmin({ shopId, adminId }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../../components/Td'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { GroupIconType } from '../types/Types'
|
import { GroupIconType } from '../types/Types'
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@ const GroupIconList: FC = () => {
|
|||||||
deleteGroupIcon.mutate(id, {
|
deleteGroupIcon.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../../components/Td'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { IconType } from '../types/Types'
|
import { IconType } from '../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
@@ -30,10 +30,10 @@ const IconsList: FC = () => {
|
|||||||
deleteIcon.mutate(id, {
|
deleteIcon.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import DefaulModal from '../../../../components/DefaulModal'
|
|||||||
import Input from '../../../../components/Input'
|
import Input from '../../../../components/Input'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateGroupIcon } from '../../hooks/useIconData'
|
import { useCreateGroupIcon } from '../../hooks/useIconData'
|
||||||
import { CreateGroupIconType } from '../../types/Types'
|
import { CreateGroupIconType } from '../../types/Types'
|
||||||
@@ -34,11 +34,11 @@ const CreateGroupIcon: FC<CreateGroupIconProps> = ({ open, close, onSuccess }) =
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
close()
|
close()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
onSuccess?.()
|
onSuccess?.()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import UploadBox from '../../../../components/UploadBox'
|
|||||||
import Select from '../../../../components/Select'
|
import Select from '../../../../components/Select'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateIcon, useGetGroupIcons } from '../../hooks/useIconData'
|
import { useCreateIcon, useGetGroupIcons } from '../../hooks/useIconData'
|
||||||
import { useMultiUpload } from '../../../service/hooks/useServiceData'
|
import { useMultiUpload } from '../../../service/hooks/useServiceData'
|
||||||
@@ -44,7 +44,7 @@ const CreateIcon: FC<CreateIconProps> = ({ open, close, onSuccess }) => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
toast.error(t('errors.required'))
|
toast(t('errors.required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,11 +67,11 @@ const CreateIcon: FC<CreateIconProps> = ({ open, close, onSuccess }) => {
|
|||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
setFiles([])
|
setFiles([])
|
||||||
close()
|
close()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
onSuccess?.()
|
onSuccess?.()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const err = error as ErrorType
|
const err = error as ErrorType
|
||||||
toast.error(err.response?.data?.error?.message?.[0])
|
toast(err.response?.data?.error?.message?.[0], 'error')
|
||||||
} finally {
|
} finally {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Td from '../../../components/Td'
|
|||||||
import { RestaurantType, RestaurantsResponse } from '../types/Types'
|
import { RestaurantType, RestaurantsResponse } from '../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import { Edit } from 'iconsax-react'
|
import { Edit } from 'iconsax-react'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import RestaurantAdminsModal from './components/RestaurantAdminsModal'
|
import RestaurantAdminsModal from './components/RestaurantAdminsModal'
|
||||||
import Pagination from '../../../components/Pagination'
|
import Pagination from '../../../components/Pagination'
|
||||||
@@ -56,11 +56,11 @@ const RestaurantsList: FC = () => {
|
|||||||
const handleDeleteRestaurant = (restaurantId: string) => {
|
const handleDeleteRestaurant = (restaurantId: string) => {
|
||||||
deleteRestaurant.mutate(restaurantId, {
|
deleteRestaurant.mutate(restaurantId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('رستوران با موفقیت حذف شد')
|
toast('رستوران با موفقیت حذف شد', 'success')
|
||||||
queryClient.invalidateQueries({ queryKey: ['restaurants'] })
|
queryClient.invalidateQueries({ queryKey: ['restaurants'] })
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
toast.error('خطا در حذف رستوران')
|
toast('خطا در حذف رستوران', 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import SwitchComponent from '../../../components/Switch'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import DatePickerComponent from '../../../components/DatePicker'
|
import DatePickerComponent from '../../../components/DatePicker'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { Pages } from '../../../config/Pages'
|
import { Pages } from '../../../config/Pages'
|
||||||
@@ -57,13 +57,13 @@ const UpdateRestaurant: FC = () => {
|
|||||||
{ id, params },
|
{ id, params },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
queryClient.invalidateQueries({ queryKey: ['restaurants'] })
|
queryClient.invalidateQueries({ queryKey: ['restaurants'] })
|
||||||
queryClient.invalidateQueries({ queryKey: ['restaurant', id] })
|
queryClient.invalidateQueries({ queryKey: ['restaurant', id] })
|
||||||
navigate(Pages.dmenu.restaurants.list)
|
navigate(Pages.dmenu.restaurants.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message?.[0] || 'خطا در بروزرسانی رستوران')
|
toast(error.response?.data?.error?.message?.[0] || 'خطا در بروزرسانی رستوران', 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Button from '../../../../components/Button'
|
|||||||
import { useAddAdminRestaurant, useGetSystemRoles } from '../../hooks/useIconData'
|
import { useAddAdminRestaurant, useGetSystemRoles } from '../../hooks/useIconData'
|
||||||
import { SystemRoleType } from '../../types/Types'
|
import { SystemRoleType } from '../../types/Types'
|
||||||
import { ErrorType } from '../../../../helpers/types'
|
import { ErrorType } from '../../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
|
|
||||||
interface AddRestaurantAdminFormProps {
|
interface AddRestaurantAdminFormProps {
|
||||||
@@ -46,13 +46,13 @@ const AddRestaurantAdminForm: FC<AddRestaurantAdminFormProps> = ({
|
|||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
addAdmin(values, {
|
addAdmin(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
onSuccess()
|
onSuccess()
|
||||||
onClose()
|
onClose()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Td from '../../../../components/Td'
|
|||||||
import { RestaurantAdminType } from '../../types/Types'
|
import { RestaurantAdminType } from '../../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
import TrashWithConfrim from '../../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { ErrorType } from '../../../../helpers/types'
|
import { ErrorType } from '../../../../helpers/types'
|
||||||
import Button from '../../../../components/Button'
|
import Button from '../../../../components/Button'
|
||||||
import AddRestaurantAdminForm from './AddRestaurantAdminForm'
|
import AddRestaurantAdminForm from './AddRestaurantAdminForm'
|
||||||
@@ -31,10 +31,10 @@ const RestaurantAdminsModal: FC<RestaurantAdminsModalProps> = ({ open, close, re
|
|||||||
deleteAdmin({ restaurantId, adminId }, {
|
deleteAdmin({ restaurantId, adminId }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../../components/Td'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../../components/TrashWithConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { StickerType } from '../types/Types'
|
import { StickerType } from '../types/Types'
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
@@ -30,10 +30,10 @@ const StickersList: FC = () => {
|
|||||||
deleteSticker.mutate(id, {
|
deleteSticker.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import UploadBox from '../../../../components/UploadBox'
|
|||||||
import Select from '../../../../components/Select'
|
import Select from '../../../../components/Select'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../../components/Toast';
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateSticker, useGetGroupStickers } from '../../hooks/useStickerData'
|
import { useCreateSticker, useGetGroupStickers } from '../../hooks/useStickerData'
|
||||||
import { useSingleUpload } from '../../../service/hooks/useServiceData'
|
import { useSingleUpload } from '../../../service/hooks/useServiceData'
|
||||||
@@ -38,11 +38,11 @@ const CreateSticker: FC<CreateStickerProps> = ({ open, close, onSuccess }) => {
|
|||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
setFile(undefined)
|
setFile(undefined)
|
||||||
close()
|
close()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
onSuccess?.()
|
onSuccess?.()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ const CreateSticker: FC<CreateStickerProps> = ({ open, close, onSuccess }) => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
toast.error(t('errors.required'))
|
toast(t('errors.required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
@@ -69,7 +69,7 @@ const CreateSticker: FC<CreateStickerProps> = ({ open, close, onSuccess }) => {
|
|||||||
handleCreateSticker(values)
|
handleCreateSticker(values)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Textarea from '../../components/Textarea'
|
|||||||
import Switch from '../../components/Switch'
|
import Switch from '../../components/Switch'
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useCreateGuide } from './hooks/useGuideData'
|
import { useCreateGuide } from './hooks/useGuideData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
|
|
||||||
@@ -50,11 +50,11 @@ const Create: FC = () => {
|
|||||||
serviceId: id || '',
|
serviceId: id || '',
|
||||||
}, {
|
}, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.services.guide + id)
|
navigate(Pages.services.guide + id)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message?.[0] || t('error'))
|
toast(error.response?.data?.error?.message?.[0] || t('error'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Textarea from '../../components/Textarea'
|
|||||||
import Switch from '../../components/Switch'
|
import Switch from '../../components/Switch'
|
||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import { useGetGuideDetail, useUpdateGuide } from './hooks/useGuideData'
|
import { useGetGuideDetail, useUpdateGuide } from './hooks/useGuideData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
|
|
||||||
@@ -53,11 +53,11 @@ const Update: FC = () => {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.services.guide + id)
|
navigate(Pages.services.guide + id)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message?.[0] || t('error'))
|
toast(error.response?.data?.error?.message?.[0] || t('error'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import Textarea from '../../components/Textarea'
|
|||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
import CreateLearningSidebar from './components/CreateLearningSidebar'
|
import CreateLearningSidebar from './components/CreateLearningSidebar'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ const CreateLearning: FC = () => {
|
|||||||
values.videoUrl = data?.data?.url
|
values.videoUrl = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -63,21 +63,21 @@ const CreateLearning: FC = () => {
|
|||||||
values.coverUrl = data?.data?.url
|
values.coverUrl = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
createLearning.mutate(values, {
|
createLearning.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.learning.list)
|
navigate(Pages.learning.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('learning.error_video_cover_required'))
|
toast(t('learning.error_video_cover_required'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Button from '../../../components/Button'
|
|||||||
import { TickCircle } from 'iconsax-react'
|
import { TickCircle } from 'iconsax-react'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { CreateCategoryLearningType } from '../types/LearningTypes'
|
import { CreateCategoryLearningType } from '../types/LearningTypes'
|
||||||
import { useCreateCategory, useGetCategory } from '../hooks/useLearningData'
|
import { useCreateCategory, useGetCategory } from '../hooks/useLearningData'
|
||||||
@@ -29,10 +29,10 @@ const CreateCategory: FC = () => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
getCategory.refetch()
|
getCategory.refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { timeAgo } from '../../config/func';
|
|||||||
import InfiniteScroll from 'react-infinite-scroll-component';
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
||||||
import MoonLoader from "react-spinners/MoonLoader"
|
import MoonLoader from "react-spinners/MoonLoader"
|
||||||
import Button from '../../components/Button';
|
import Button from '../../components/Button';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from '../../components/Toast';
|
||||||
// import { useGetDashboardSummary } from '../home/hooks/useHomeData';
|
// import { useGetDashboardSummary } from '../home/hooks/useHomeData';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Pages } from '../../config/Pages';
|
import { Pages } from '../../config/Pages';
|
||||||
@@ -33,7 +33,7 @@ const Notifications: FC = () => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
getDashboard.refetch()
|
getDashboard.refetch()
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { useApproveTransfer } from '../hooks/usePaymentData'
|
import { useApproveTransfer } from '../hooks/usePaymentData'
|
||||||
import ModalConfrim from '../../../components/ModalConfrim'
|
import ModalConfrim from '../../../components/ModalConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -19,12 +19,12 @@ const Accept: FC<Props> = (props: Props) => {
|
|||||||
const handleApproveTransfer = () => {
|
const handleApproveTransfer = () => {
|
||||||
approveTransfer.mutate(props.id, {
|
approveTransfer.mutate(props.id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
setOpenConfrimModal(false)
|
setOpenConfrimModal(false)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Button from '../../../components/Button'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useRejectTransfer } from '../hooks/usePaymentData'
|
import { useRejectTransfer } from '../hooks/usePaymentData'
|
||||||
import ModalConfrim from '../../../components/ModalConfrim'
|
import ModalConfrim from '../../../components/ModalConfrim'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -20,16 +20,16 @@ const Reject: FC<Props> = (props: Props) => {
|
|||||||
if (text && text.length > 0) {
|
if (text && text.length > 0) {
|
||||||
rejectTransfer.mutate({ id: props.id, comment: text }, {
|
rejectTransfer.mutate({ id: props.id, comment: text }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
setOpenConfrimModal(false)
|
setOpenConfrimModal(false)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('payment.reject_comment_error'))
|
toast(t('payment.reject_comment_error'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import DatePickerComponent from '../../components/DatePicker'
|
|||||||
import { useGetProfile, useUpdateProfile } from './hooks/useProfileData'
|
import { useGetProfile, useUpdateProfile } from './hooks/useProfileData'
|
||||||
import Username from './components/Username'
|
import Username from './components/Username'
|
||||||
import { useDropzone } from 'react-dropzone'
|
import { useDropzone } from 'react-dropzone'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { UpdateProfileType } from './types/ProfileTypes'
|
import { UpdateProfileType } from './types/ProfileTypes'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
@@ -42,10 +42,10 @@ const Profile: FC = () => {
|
|||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
updateProfile.mutate(values, {
|
updateProfile.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -80,19 +80,19 @@ const Profile: FC = () => {
|
|||||||
}
|
}
|
||||||
updateProfile.mutate(params, {
|
updateProfile.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('profile.image_uploaded_successfully'))
|
toast(t('profile.image_uploaded_successfully'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('errors.is_not_image'))
|
toast(t('errors.is_not_image'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import DefaulModal from '../../../components/DefaulModal'
|
|||||||
import OTPInput from 'react-otp-input'
|
import OTPInput from 'react-otp-input'
|
||||||
import { useUpdateEmail } from '../hooks/useProfileData'
|
import { useUpdateEmail } from '../hooks/useProfileData'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
email: string | null,
|
email: string | null,
|
||||||
@@ -27,10 +27,10 @@ const Email: FC<Props> = (props: Props) => {
|
|||||||
const handleShowModal = () => {
|
const handleShowModal = () => {
|
||||||
updateEmail.mutate({ email: email }, {
|
updateEmail.mutate({ email: email }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('profile.link_email'))
|
toast(t('profile.link_email'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import DefaulModal from '../../../components/DefaulModal'
|
|||||||
import OTPInput from 'react-otp-input'
|
import OTPInput from 'react-otp-input'
|
||||||
import { useUpdatePhone, useVerifyPhone } from '../hooks/useProfileData'
|
import { useUpdatePhone, useVerifyPhone } from '../hooks/useProfileData'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { VerifyPhoneType } from '../types/ProfileTypes'
|
import { VerifyPhoneType } from '../types/ProfileTypes'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -30,7 +30,7 @@ const Phone: FC<Props> = (props: Props) => {
|
|||||||
setShowModal(true)
|
setShowModal(true)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -45,10 +45,10 @@ const Phone: FC<Props> = (props: Props) => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
setIsReadOnly(true)
|
setIsReadOnly(true)
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { useCheckUserName, useUpdateProfile } from '../hooks/useProfileData'
|
import { useCheckUserName, useUpdateProfile } from '../hooks/useProfileData'
|
||||||
import { CheckUserNameType, UpdateProfileType } from '../types/ProfileTypes'
|
import { CheckUserNameType, UpdateProfileType } from '../types/ProfileTypes'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -54,13 +54,13 @@ const Username: FC<Props> = (props: Props) => {
|
|||||||
|
|
||||||
updateProfile.mutate(params, {
|
updateProfile.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('profile.username_save_success'))
|
toast(t('profile.username_save_success'), 'success')
|
||||||
setCanEdit(false)
|
setCanEdit(false)
|
||||||
setCanSave(false)
|
setCanSave(false)
|
||||||
setStatus('')
|
setStatus('')
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error.response?.data?.error?.message?.[0])
|
toast(error.response?.data?.error?.message?.[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Input from '../../components/Input'
|
|||||||
import { CreateReceiptType, ReceiptCreateItemsType } from './types/ReceiptTypes'
|
import { CreateReceiptType, ReceiptCreateItemsType } from './types/ReceiptTypes'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
||||||
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
@@ -70,11 +70,11 @@ const CreateReceipt: FC = () => {
|
|||||||
|
|
||||||
createInvoice.mutate(params, {
|
createInvoice.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.receipts.index)
|
navigate(Pages.receipts.index)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ const CreateReceipt: FC = () => {
|
|||||||
|
|
||||||
<div onClick={() => {
|
<div onClick={() => {
|
||||||
if (formik.errors.name || formik.errors.count || formik.errors.unitPrice || formik.errors.discount) {
|
if (formik.errors.name || formik.errors.count || formik.errors.unitPrice || formik.errors.discount) {
|
||||||
toast.error(t('receip.error_empty'))
|
toast(t('receip.error_empty'), 'error')
|
||||||
} else {
|
} else {
|
||||||
formik.handleSubmit()
|
formik.handleSubmit()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Input from '../../components/Input'
|
|||||||
import { CreateReceiptType, ReceiptCreateItemsType } from './types/ReceiptTypes'
|
import { CreateReceiptType, ReceiptCreateItemsType } from './types/ReceiptTypes'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
||||||
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
@@ -86,11 +86,11 @@ const CreateReceipt: FC = () => {
|
|||||||
|
|
||||||
updateInvoice.mutate({ id: id as string, params }, {
|
updateInvoice.mutate({ id: id as string, params }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.receipts.index)
|
navigate(Pages.receipts.index)
|
||||||
},
|
},
|
||||||
onError(error: ErrorType) {
|
onError(error: ErrorType) {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ const CreateReceipt: FC = () => {
|
|||||||
|
|
||||||
<div onClick={() => {
|
<div onClick={() => {
|
||||||
if (formik.errors.name || formik.errors.count || formik.errors.unitPrice || formik.errors.discount) {
|
if (formik.errors.name || formik.errors.count || formik.errors.unitPrice || formik.errors.discount) {
|
||||||
toast.error(t('receip.error_empty'))
|
toast(t('receip.error_empty'), 'error')
|
||||||
} else {
|
} else {
|
||||||
formik.handleSubmit()
|
formik.handleSubmit()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import Pagination from '../../components/Pagination'
|
|||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const ReceiptsList: FC = () => {
|
const ReceiptsList: FC = () => {
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@ const ReceiptsList: FC = () => {
|
|||||||
const handleDeleteInvoice = (id: string) => {
|
const handleDeleteInvoice = (id: string) => {
|
||||||
deleteInvoice.mutate(id, {
|
deleteInvoice.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
getInvoices.refetch()
|
getInvoices.refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { useCreateResellers } from './hooks/useResellerData'
|
import { useCreateResellers } from './hooks/useResellerData'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import Input from '../../components/Input'
|
import Input from '../../components/Input'
|
||||||
|
|
||||||
const CreateReseller: FC = () => {
|
const CreateReseller: FC = () => {
|
||||||
@@ -32,7 +32,7 @@ const CreateReseller: FC = () => {
|
|||||||
navigate(-1)
|
navigate(-1)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Button from '../../../components/Button'
|
|||||||
import DefaulModal from '../../../components/DefaulModal'
|
import DefaulModal from '../../../components/DefaulModal'
|
||||||
import { usePayment } from '../hooks/useResellerData'
|
import { usePayment } from '../hooks/useResellerData'
|
||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -26,11 +26,11 @@ const Payment: FC<Props> = ({ id, refetch }) => {
|
|||||||
refetch()
|
refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error('شماره تراکنش رو پر کنید')
|
toast('شماره تراکنش رو پر کنید', 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import * as Yup from 'yup'
|
|||||||
import { useCreateService, useMultiUpload, useSingleUpload } from './hooks/useServiceData';
|
import { useCreateService, useMultiUpload, useSingleUpload } from './hooks/useServiceData';
|
||||||
import moment from 'moment-jalaali';
|
import moment from 'moment-jalaali';
|
||||||
import { ErrorType } from '../../helpers/types';
|
import { ErrorType } from '../../helpers/types';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from '../../components/Toast';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Pages } from '../../config/Pages';
|
import { Pages } from '../../config/Pages';
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ const AddService: FC = () => {
|
|||||||
values.icon = data?.data?.url
|
values.icon = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ const AddService: FC = () => {
|
|||||||
values.images = await data.data.map((item: { url: string }) => item?.url)
|
values.images = await data.data.map((item: { url: string }) => item?.url)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ const AddService: FC = () => {
|
|||||||
values.audios = await data.data.map((item: { url: string }) => item?.url)
|
values.audios = await data.data.map((item: { url: string }) => item?.url)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -144,7 +144,7 @@ const AddService: FC = () => {
|
|||||||
values.videos = await data.data.map((item: { url: string }) => item?.url)
|
values.videos = await data.data.map((item: { url: string }) => item?.url)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -159,15 +159,15 @@ const AddService: FC = () => {
|
|||||||
createService.mutate(params, {
|
createService.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.services.list)
|
navigate(Pages.services.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('errors.upload_image'))
|
toast(t('errors.upload_image'), 'error')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as Yup from 'yup'
|
|||||||
import { useGetDetailService, useMultiUpload, useSingleUpload, useUpdateService } from './hooks/useServiceData';
|
import { useGetDetailService, useMultiUpload, useSingleUpload, useUpdateService } from './hooks/useServiceData';
|
||||||
import moment from 'moment-jalaali';
|
import moment from 'moment-jalaali';
|
||||||
import { ErrorType } from '../../helpers/types';
|
import { ErrorType } from '../../helpers/types';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from '../../components/Toast';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { Pages } from '../../config/Pages';
|
import { Pages } from '../../config/Pages';
|
||||||
import UpdateServiceSidebar from './components/UpdateServiceSidebar';
|
import UpdateServiceSidebar from './components/UpdateServiceSidebar';
|
||||||
@@ -103,7 +103,7 @@ const UpdateService: FC = () => {
|
|||||||
values.icon = data?.data?.url
|
values.icon = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ const UpdateService: FC = () => {
|
|||||||
values.images = [...(values.images || []), ...data.data.map((item: { url: string }) => item?.url)]
|
values.images = [...(values.images || []), ...data.data.map((item: { url: string }) => item?.url)]
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ const UpdateService: FC = () => {
|
|||||||
values.audios = [...(values.audios || []), ...data.data.map((item: { url: string }) => item?.url)]
|
values.audios = [...(values.audios || []), ...data.data.map((item: { url: string }) => item?.url)]
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -152,7 +152,7 @@ const UpdateService: FC = () => {
|
|||||||
values.videos = [...(values.videos || []), ...data.data.map((item: { url: string }) => item?.url)]
|
values.videos = [...(values.videos || []), ...data.data.map((item: { url: string }) => item?.url)]
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -167,11 +167,11 @@ const UpdateService: FC = () => {
|
|||||||
createService.mutate(params, {
|
createService.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.services.list)
|
navigate(Pages.services.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useCreateServiceCategory, useGetCategoryParents, useSingleUpload } from
|
|||||||
import { CreateServiceCategoryType, ServiceCategoryType } from '../types/ServiceTypes'
|
import { CreateServiceCategoryType, ServiceCategoryType } from '../types/ServiceTypes'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
const CreateCategory: FC = () => {
|
const CreateCategory: FC = () => {
|
||||||
@@ -33,7 +33,7 @@ const CreateCategory: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
toast.error(t('errors.upload_image'))
|
toast(t('errors.upload_image'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ const CreateCategory: FC = () => {
|
|||||||
values.icon = data?.data?.url
|
values.icon = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ const CreateCategory: FC = () => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
getCategory.refetch()
|
getCategory.refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useFormik } from 'formik'
|
|||||||
import { CreateItemPlanType, CreatePlanType } from '../types/ServiceTypes'
|
import { CreateItemPlanType, CreatePlanType } from '../types/ServiceTypes'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { clx } from '../../../helpers/utils'
|
import { clx } from '../../../helpers/utils'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { useCreatePlan, useGetPlans } from '../hooks/useServiceData'
|
import { useCreatePlan, useGetPlans } from '../hooks/useServiceData'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
@@ -55,7 +55,7 @@ const CreatePlan: FC = () => {
|
|||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
toast.error(t('plan.error_submit'))
|
toast(t('plan.error_submit'), 'error')
|
||||||
} else {
|
} else {
|
||||||
const params: CreatePlanType = {
|
const params: CreatePlanType = {
|
||||||
serviceId: id ? id : '',
|
serviceId: id ? id : '',
|
||||||
@@ -66,10 +66,10 @@ const CreatePlan: FC = () => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
toast.success(t('plan.success_submit'))
|
toast(t('plan.success_submit'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useFormik } from 'formik'
|
|||||||
import { CreateItemPlanType, UpdatePlanType } from '../types/ServiceTypes'
|
import { CreateItemPlanType, UpdatePlanType } from '../types/ServiceTypes'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { clx } from '../../../helpers/utils'
|
import { clx } from '../../../helpers/utils'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { useGetPlanDetail, useUpdatePlan } from '../hooks/useServiceData'
|
import { useGetPlanDetail, useUpdatePlan } from '../hooks/useServiceData'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
@@ -49,11 +49,11 @@ const EditPlan: FC<Props> = (props: Props) => {
|
|||||||
}
|
}
|
||||||
updatePlan.mutate(params, {
|
updatePlan.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Input from '../../../components/Input'
|
|||||||
import { CreateServiceCategoryType, ServiceCategoryType } from '../types/ServiceTypes'
|
import { CreateServiceCategoryType, ServiceCategoryType } from '../types/ServiceTypes'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import Select from '../../../components/Select'
|
import Select from '../../../components/Select'
|
||||||
@@ -47,7 +47,7 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
values.icon = data?.data?.url
|
values.icon = data?.data?.url
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -63,12 +63,12 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
getCategory.refetch()
|
getCategory.refetch()
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
props.refetch()
|
props.refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error?.response?.data?.error?.message[0])
|
toast(error?.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Input from '../../components/Input'
|
|||||||
import Textarea from '../../components/Textarea'
|
import Textarea from '../../components/Textarea'
|
||||||
import UploadBox from '../../components/UploadBox'
|
import UploadBox from '../../components/UploadBox'
|
||||||
import SwitchComponent from '../../components/Switch'
|
import SwitchComponent from '../../components/Switch'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
@@ -39,7 +39,7 @@ const CreateSlider: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
toast.error(t('slider.image_required'))
|
toast(t('slider.image_required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +55,11 @@ const CreateSlider: FC = () => {
|
|||||||
|
|
||||||
createSlider.mutate(values, {
|
createSlider.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('slider.slider_created'))
|
toast(t('slider.slider_created'), 'success')
|
||||||
navigate(Pages.sliders.list)
|
navigate(Pages.sliders.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Td from '../../components/Td'
|
|||||||
import { useDeleteSlider, useGetSliders } from './hooks/useSliderData'
|
import { useDeleteSlider, useGetSliders } from './hooks/useSliderData'
|
||||||
import { SliderItemType } from './types/SliderTypes'
|
import { SliderItemType } from './types/SliderTypes'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
||||||
const SliderList: FC = () => {
|
const SliderList: FC = () => {
|
||||||
@@ -20,11 +20,11 @@ const SliderList: FC = () => {
|
|||||||
const handleDelete = (id: string) => {
|
const handleDelete = (id: string) => {
|
||||||
deleteSlider.mutate(id, {
|
deleteSlider.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('slider.slider_deleted'))
|
toast(t('slider.slider_deleted'), 'success')
|
||||||
refetch()
|
refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Input from '../../components/Input'
|
|||||||
import Textarea from '../../components/Textarea'
|
import Textarea from '../../components/Textarea'
|
||||||
import UploadBox from '../../components/UploadBox'
|
import UploadBox from '../../components/UploadBox'
|
||||||
import SwitchComponent from '../../components/Switch'
|
import SwitchComponent from '../../components/Switch'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
@@ -56,11 +56,11 @@ const UpdateSlider: FC = () => {
|
|||||||
|
|
||||||
updateSlider.mutate({ id: id || '', data: values }, {
|
updateSlider.mutate({ id: id || '', data: values }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('slider.slider_created'))
|
toast(t('slider.slider_created'), 'success')
|
||||||
navigate(Pages.sliders.list)
|
navigate(Pages.sliders.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useGetAllServices } from '../service/hooks/useServiceData'
|
|||||||
import { ServiceItemType } from '../service/types/ServiceTypes'
|
import { ServiceItemType } from '../service/types/ServiceTypes'
|
||||||
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
import TrashWithConfrim from '../../components/TrashWithConfrim'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const SubscriptionsList: FC = () => {
|
const SubscriptionsList: FC = () => {
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ const SubscriptionsList: FC = () => {
|
|||||||
refetch()
|
refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CreatePlanType } from './types/SupportTypes'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import Select from '../../components/Select'
|
import Select from '../../components/Select'
|
||||||
import { useCreateSupport } from './hooks/useSupportData'
|
import { useCreateSupport } from './hooks/useSupportData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -104,11 +104,11 @@ const CreatePlan: FC = () => {
|
|||||||
}
|
}
|
||||||
createSupport.mutate(planData, {
|
createSupport.mutate(planData, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('پلن با موفقیت ساخته شد')
|
toast('پلن با موفقیت ساخته شد', 'success')
|
||||||
navigate(Pages.support.list)
|
navigate(Pages.support.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CreatePlanType } from './types/SupportTypes'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import Select from '../../components/Select'
|
import Select from '../../components/Select'
|
||||||
import { useGetPlanById, useUpdateSupport } from './hooks/useSupportData'
|
import { useGetPlanById, useUpdateSupport } from './hooks/useSupportData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -118,11 +118,11 @@ const UpdatePlan: FC = () => {
|
|||||||
}
|
}
|
||||||
updateSupport.mutate({ id: id ?? '', data: planData }, {
|
updateSupport.mutate({ id: id ?? '', data: planData }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success('پلن با موفقیت ویرایش شد')
|
toast('پلن با موفقیت ویرایش شد', 'success')
|
||||||
navigate(Pages.support.list)
|
navigate(Pages.support.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Add, AddCircle, CloseCircle } from "iconsax-react";
|
import { Add, AddCircle, CloseCircle } from "iconsax-react";
|
||||||
import { useRef, useState, type FC } from "react";
|
import { useRef, useState, type FC } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import ColorsImage from "../../../assets/images/colors.png";
|
import ColorsImage from "../../../assets/images/colors.png";
|
||||||
import { ErrorType } from "../../../helpers/types";
|
import { ErrorType } from "../../../helpers/types";
|
||||||
import { clx } from "../../../helpers/utils";
|
import { clx } from "../../../helpers/utils";
|
||||||
@@ -47,11 +47,11 @@ const AddNewColumn: FC<Props> = ({ projectId, nextOrder, onColumnCreated }) => {
|
|||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
const phase = (data?.data ?? data) as TaskPhaseItemType;
|
const phase = (data?.data ?? data) as TaskPhaseItemType;
|
||||||
onColumnCreated(phase);
|
onColumnCreated(phase);
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
resetForm();
|
resetForm();
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Draggable, Droppable } from "@hello-pangea/dnd";
|
|||||||
import { Add, AddCircle, CloseCircle } from "iconsax-react";
|
import { Add, AddCircle, CloseCircle } from "iconsax-react";
|
||||||
import { useMemo, useRef, useState, type FC } from "react";
|
import { useMemo, useRef, useState, type FC } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import ModalConfrim from "../../../components/ModalConfrim";
|
import ModalConfrim from "../../../components/ModalConfrim";
|
||||||
import { ErrorType } from "../../../helpers/types";
|
import { ErrorType } from "../../../helpers/types";
|
||||||
import { useCreateTask, useGetTasksByTaskPhase } from "../task/hooks/useTaskData";
|
import { useCreateTask, useGetTasksByTaskPhase } from "../task/hooks/useTaskData";
|
||||||
@@ -147,11 +147,11 @@ const Column: FC<Props> = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
resetTaskForm();
|
resetTaskForm();
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -164,10 +164,10 @@ const Column: FC<Props> = ({
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onColumnDeleted?.(column.id);
|
onColumnDeleted?.(column.id);
|
||||||
setIsDeleteConfirmOpen(false);
|
setIsDeleteConfirmOpen(false);
|
||||||
toast.success(t("taskmanager.column_deleted"));
|
toast(t("taskmanager.column_deleted"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -206,12 +206,12 @@ const Column: FC<Props> = ({
|
|||||||
{ id: column.id, params: { name: trimmedTitle }, projectId },
|
{ id: column.id, params: { name: trimmedTitle }, projectId },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("taskmanager.column_updated"));
|
toast(t("taskmanager.column_updated"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
onColumnTitleUpdated?.(column.id, previousTitle);
|
onColumnTitleUpdated?.(column.id, previousTitle);
|
||||||
setEditTitle(previousTitle);
|
setEditTitle(previousTitle);
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type FC, useEffect, useRef, useState } from "react";
|
import { type FC, useEffect, useRef, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../../components/Toast';
|
||||||
import DefaulModal from "../../../../components/DefaulModal";
|
import DefaulModal from "../../../../components/DefaulModal";
|
||||||
import PageLoading from "../../../../components/PageLoading";
|
import PageLoading from "../../../../components/PageLoading";
|
||||||
import { ErrorType } from "../../../../helpers/types";
|
import { ErrorType } from "../../../../helpers/types";
|
||||||
@@ -86,11 +86,11 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
|||||||
{ id: task.id, projectId: taskDetail?.projectId ?? "" },
|
{ id: task.id, projectId: taskDetail?.projectId ?? "" },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("taskmanager.task_deleted"));
|
toast(t("taskmanager.task_deleted"), 'success');
|
||||||
onClose();
|
onClose();
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -109,10 +109,10 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
|||||||
} else {
|
} else {
|
||||||
initialDescriptionRef.current = value;
|
initialDescriptionRef.current = value;
|
||||||
}
|
}
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
if (field === "title") {
|
if (field === "title") {
|
||||||
setTitle(initialTitleRef.current);
|
setTitle(initialTitleRef.current);
|
||||||
} else {
|
} else {
|
||||||
@@ -131,11 +131,11 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
|||||||
{ id: task.id, params: { color: newColor ?? "" } },
|
{ id: task.id, params: { color: newColor ?? "" } },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
setColor(previousColor);
|
setColor(previousColor);
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -149,10 +149,10 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
|||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onTaskPhaseChanged?.(task.id, taskPhaseId);
|
onTaskPhaseChanged?.(task.id, taskPhaseId);
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type FC, useEffect, useMemo, useState } from "react";
|
import { type FC, useEffect, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../../components/Toast';
|
||||||
import { useGetUsersInfinite } from "../../../users/hooks/useUserData";
|
import { useGetUsersInfinite } from "../../../users/hooks/useUserData";
|
||||||
import TaskDetailAttachmentPopover from "./attachment/TaskDetailAttachmentPopover";
|
import TaskDetailAttachmentPopover from "./attachment/TaskDetailAttachmentPopover";
|
||||||
import TaskDetailDatePopover from "./date/TaskDetailDatePopover";
|
import TaskDetailDatePopover from "./date/TaskDetailDatePopover";
|
||||||
@@ -186,10 +186,10 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
{ id: effectiveTaskId, params: { userIds: Array.from(next) } },
|
{ id: effectiveTaskId, params: { userIds: Array.from(next) } },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
setSelectedUserIds(previous);
|
setSelectedUserIds(previous);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -215,10 +215,10 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
setSelectedLabelIds((prev) => new Set([...prev, newLabel.id]));
|
setSelectedLabelIds((prev) => new Set([...prev, newLabel.id]));
|
||||||
}
|
}
|
||||||
setLabelsView("list");
|
setLabelsView("list");
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -237,10 +237,10 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
handleChecklistClose();
|
handleChecklistClose();
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -264,7 +264,7 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
const uploadResult = await singleUpload.mutateAsync(formData);
|
const uploadResult = await singleUpload.mutateAsync(formData);
|
||||||
fileUrl = uploadResult?.data?.url ?? "";
|
fileUrl = uploadResult?.data?.url ?? "";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error((error as ErrorType).response?.data?.error.message[0]);
|
toast((error as ErrorType).response?.data?.error.message[0], 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,10 +279,10 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
handleAttachmentClose();
|
handleAttachmentClose();
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -313,10 +313,10 @@ const TaskDetailToolbar: FC<Props> = ({ activeTab, onTabChange, taskDetail, task
|
|||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
handleDateClose();
|
handleDateClose();
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
setStartDate(previousStartDate);
|
setStartDate(previousStartDate);
|
||||||
setEndDate(previousEndDate);
|
setEndDate(previousEndDate);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Edit } from "iconsax-react";
|
import { Edit } from "iconsax-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../../../components/Toast';
|
||||||
import ProgressBar from "../../../../../components/ProgressBar";
|
import ProgressBar from "../../../../../components/ProgressBar";
|
||||||
import TrashWithConfrim from "../../../../../components/TrashWithConfrim";
|
import TrashWithConfrim from "../../../../../components/TrashWithConfrim";
|
||||||
import { ErrorType } from "../../../../../helpers/types";
|
import { ErrorType } from "../../../../../helpers/types";
|
||||||
@@ -39,7 +39,7 @@ const CheckLists = ({
|
|||||||
{ id, params: { isDone: !checked }, taskId },
|
{ id, params: { isDone: !checked }, taskId },
|
||||||
{
|
{
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type FC, useEffect, useMemo, useState } from "react";
|
import { type FC, useEffect, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../../../components/Toast';
|
||||||
import { ErrorType } from "../../../../../helpers/types";
|
import { ErrorType } from "../../../../../helpers/types";
|
||||||
import { useEndTimeTracking, useGetTaskTimes, useStartTimeTracking } from "../../../task/hooks/useTaskTimeData";
|
import { useEndTimeTracking, useGetTaskTimes, useStartTimeTracking } from "../../../task/hooks/useTaskTimeData";
|
||||||
import { formatElapsedTime, getActiveTimeEntry, getElapsedSeconds } from "./utils";
|
import { formatElapsedTime, getActiveTimeEntry, getElapsedSeconds } from "./utils";
|
||||||
@@ -45,10 +45,10 @@ const TaskDetailTimePopover: FC<Props> = ({ taskId }) => {
|
|||||||
const handleStart = () => {
|
const handleStart = () => {
|
||||||
startTimeTracking.mutate(taskId, {
|
startTimeTracking.mutate(taskId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -56,10 +56,10 @@ const TaskDetailTimePopover: FC<Props> = ({ taskId }) => {
|
|||||||
const handleStop = () => {
|
const handleStop = () => {
|
||||||
endTimeTracking.mutate(taskId, {
|
endTimeTracking.mutate(taskId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { TickCircle } from "iconsax-react";
|
|||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import moment from "moment-jalaali";
|
import moment from "moment-jalaali";
|
||||||
import Button from "../../../components/Button";
|
import Button from "../../../components/Button";
|
||||||
@@ -36,11 +36,11 @@ const CreateProject: FC = () => {
|
|||||||
const handleCreateProject = async (values: CreateProjectType) => {
|
const handleCreateProject = async (values: CreateProjectType) => {
|
||||||
createProject.mutate(values, {
|
createProject.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
navigate(`${Pages.taskmanager.projectList}${workspaceId}`);
|
navigate(`${Pages.taskmanager.projectList}${workspaceId}`);
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -62,7 +62,7 @@ const CreateProject: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
toast.error(t("taskmanager.select_workspace"));
|
toast(t("taskmanager.select_workspace"), 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ const CreateProject: FC = () => {
|
|||||||
backgroundPicture = uploadResult?.data?.url ?? "";
|
backgroundPicture = uploadResult?.data?.url ?? "";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const uploadError = error as ErrorType;
|
const uploadError = error as ErrorType;
|
||||||
toast.error(uploadError.response?.data?.error.message[0]);
|
toast(uploadError.response?.data?.error.message[0], 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { TickCircle } from "iconsax-react";
|
|||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import moment from "moment-jalaali";
|
import moment from "moment-jalaali";
|
||||||
import Button from "../../../components/Button";
|
import Button from "../../../components/Button";
|
||||||
@@ -48,11 +48,11 @@ const UpdateProject: FC = () => {
|
|||||||
{ id, params: values },
|
{ id, params: values },
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
navigate(`${Pages.taskmanager.projectList}${values.workspaceId}`);
|
navigate(`${Pages.taskmanager.projectList}${values.workspaceId}`);
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -75,7 +75,7 @@ const UpdateProject: FC = () => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: async (values) => {
|
onSubmit: async (values) => {
|
||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
toast.error(t("taskmanager.select_workspace"));
|
toast(t("taskmanager.select_workspace"), 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ const UpdateProject: FC = () => {
|
|||||||
backgroundPicture = uploadResult?.data?.url ?? "";
|
backgroundPicture = uploadResult?.data?.url ?? "";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const uploadError = error as ErrorType;
|
const uploadError = error as ErrorType;
|
||||||
toast.error(uploadError.response?.data?.error.message[0]);
|
toast(uploadError.response?.data?.error.message[0], 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { CloseCircle, TickCircle } from "iconsax-react";
|
|||||||
import { type FC, useEffect, useState } from "react";
|
import { type FC, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../../components/Toast';
|
||||||
import Button from "../../../../components/Button";
|
import Button from "../../../../components/Button";
|
||||||
import { ErrorType } from "../../../../helpers/types";
|
import { ErrorType } from "../../../../helpers/types";
|
||||||
import { clx } from "../../../../helpers/utils";
|
import { clx } from "../../../../helpers/utils";
|
||||||
@@ -82,7 +82,7 @@ const ProjectSettingsPanel: FC<Props> = ({ open, onClose, projectId, project })
|
|||||||
if (!project) return;
|
if (!project) return;
|
||||||
|
|
||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
toast.error(t("taskmanager.select_workspace"));
|
toast(t("taskmanager.select_workspace"), 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ const ProjectSettingsPanel: FC<Props> = ({ open, onClose, projectId, project })
|
|||||||
backgroundPicture = uploadResult?.data?.url ?? "";
|
backgroundPicture = uploadResult?.data?.url ?? "";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const uploadError = error as ErrorType;
|
const uploadError = error as ErrorType;
|
||||||
toast.error(uploadError.response?.data?.error.message[0]);
|
toast(uploadError.response?.data?.error.message[0], 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,13 +119,13 @@ const ProjectSettingsPanel: FC<Props> = ({ open, onClose, projectId, project })
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
queryClient.invalidateQueries({ queryKey: ["project", projectId] });
|
queryClient.invalidateQueries({ queryKey: ["project", projectId] });
|
||||||
queryClient.invalidateQueries({ queryKey: ["project-detail", projectId] });
|
queryClient.invalidateQueries({ queryKey: ["project-detail", projectId] });
|
||||||
onClose();
|
onClose();
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { DragDropContext, type DragStart, type DropResult } from "@hello-pangea/
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { useEffect, useState, type FC } from "react";
|
import { useEffect, useState, type FC } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../components/Toast';
|
||||||
import PageLoading from "../../components/PageLoading";
|
import PageLoading from "../../components/PageLoading";
|
||||||
import { ErrorType } from "../../helpers/types";
|
import { ErrorType } from "../../helpers/types";
|
||||||
import AddNewColumn from "./components/AddNewColumn";
|
import AddNewColumn from "./components/AddNewColumn";
|
||||||
@@ -89,7 +89,7 @@ const Workspace: FC = () => {
|
|||||||
if (previousData) {
|
if (previousData) {
|
||||||
queryClient.setQueryData(["tasks-by-task-phase", columnId], previousData);
|
queryClient.setQueryData(["tasks-by-task-phase", columnId], previousData);
|
||||||
}
|
}
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -140,7 +140,7 @@ const Workspace: FC = () => {
|
|||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["tasks-by-task-phase", sourceColumnId] });
|
queryClient.invalidateQueries({ queryKey: ["tasks-by-task-phase", sourceColumnId] });
|
||||||
queryClient.invalidateQueries({ queryKey: ["tasks-by-task-phase", columnId] });
|
queryClient.invalidateQueries({ queryKey: ["tasks-by-task-phase", columnId] });
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -160,7 +160,7 @@ const Workspace: FC = () => {
|
|||||||
if (selectedTask?.id === activeTask.id) {
|
if (selectedTask?.id === activeTask.id) {
|
||||||
setSelectedTask(activeTask);
|
setSelectedTask(activeTask);
|
||||||
}
|
}
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -214,7 +214,7 @@ const Workspace: FC = () => {
|
|||||||
{
|
{
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
setColumns(previousColumns);
|
setColumns(previousColumns);
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { TickCircle } from "iconsax-react";
|
|||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import Button from "../../../components/Button";
|
import Button from "../../../components/Button";
|
||||||
import Input from "../../../components/Input";
|
import Input from "../../../components/Input";
|
||||||
@@ -28,11 +28,11 @@ const CreateWorkspace: FC = () => {
|
|||||||
const handleCreateWorkspace = (values: CreateWorkspaceType) => {
|
const handleCreateWorkspace = (values: CreateWorkspaceType) => {
|
||||||
createWorkspace.mutate(values, {
|
createWorkspace.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
navigate(Pages.taskmanager.workspaceList);
|
navigate(Pages.taskmanager.workspaceList);
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Add, Edit } from "iconsax-react";
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import Button from "../../../components/Button";
|
import Button from "../../../components/Button";
|
||||||
import PageLoading from "../../../components/PageLoading";
|
import PageLoading from "../../../components/PageLoading";
|
||||||
import Td from "../../../components/Td";
|
import Td from "../../../components/Td";
|
||||||
@@ -22,10 +22,10 @@ const WorkspaceList: FC = () => {
|
|||||||
const handleDelete = (id: string) => {
|
const handleDelete = (id: string) => {
|
||||||
deleteWorkspace.mutate(id, {
|
deleteWorkspace.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("taskmanager.workspace_deleted"));
|
toast(t("taskmanager.workspace_deleted"), 'success');
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { TickCircle } from "iconsax-react";
|
|||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from '../../../components/Toast';
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import Button from "../../../components/Button";
|
import Button from "../../../components/Button";
|
||||||
import Input from "../../../components/Input";
|
import Input from "../../../components/Input";
|
||||||
@@ -45,11 +45,11 @@ const UpdateWorkspace: FC = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t("success"));
|
toast(t("success"), 'success');
|
||||||
navigate(Pages.taskmanager.workspaceList);
|
navigate(Pages.taskmanager.workspaceList);
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0]);
|
toast(error.response?.data?.error.message[0], 'error');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import Button from '../../components/Button'
|
|||||||
import { useCreateCategory, useGetCategories } from './hooks/useTicketData'
|
import { useCreateCategory, useGetCategories } from './hooks/useTicketData'
|
||||||
import Textarea from '../../components/Textarea'
|
import Textarea from '../../components/Textarea'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const TicketCategory: FC = () => {
|
const TicketCategory: FC = () => {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ const TicketCategory: FC = () => {
|
|||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { ErrorType } from '../../helpers/types'
|
|||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { CreateTicketAdminType } from './types/TicketTypes'
|
import { CreateTicketAdminType } from './types/TicketTypes'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { useMultiUpload } from '../service/hooks/useServiceData'
|
import { useMultiUpload } from '../service/hooks/useServiceData'
|
||||||
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
import { useGetCustomers } from '../customer/hooks/useCustomerData'
|
||||||
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
import { CustomerItemType } from '../customer/types/CustomerTypes'
|
||||||
@@ -57,7 +57,7 @@ const CreateTicket: FC = () => {
|
|||||||
values.attachmentUrls = await data.data.map((item: { url: string }) => item?.url)
|
values.attachmentUrls = await data.data.map((item: { url: string }) => item?.url)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -71,12 +71,12 @@ const CreateTicket: FC = () => {
|
|||||||
|
|
||||||
createTicket.mutate(values, {
|
createTicket.mutate(values, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
navigate(Pages.ticket.detail + data.data?.ticketId)
|
navigate(Pages.ticket.detail + data.data?.ticketId)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import moment from 'moment-jalaali'
|
|||||||
import { useFormik } from 'formik'
|
import { useFormik } from 'formik'
|
||||||
import { AddMessageTicketType, TicketMessageType } from './types/TicketTypes'
|
import { AddMessageTicketType, TicketMessageType } from './types/TicketTypes'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { clx } from '../../helpers/utils'
|
import { clx } from '../../helpers/utils'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -51,7 +51,7 @@ const TicketDetail: FC = () => {
|
|||||||
values.attachmentUrls = await data.data.map((item: { url: string }) => item?.url)
|
values.attachmentUrls = await data.data.map((item: { url: string }) => item?.url)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0] ?? t('error'), 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -60,7 +60,7 @@ const TicketDetail: FC = () => {
|
|||||||
|
|
||||||
addMessage.mutate(values, {
|
addMessage.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
formik.resetForm()
|
formik.resetForm()
|
||||||
setFiles([])
|
setFiles([])
|
||||||
setIsResetFiles(true)
|
setIsResetFiles(true)
|
||||||
@@ -69,7 +69,7 @@ const TicketDetail: FC = () => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0] ?? t('error'), 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -78,11 +78,11 @@ const TicketDetail: FC = () => {
|
|||||||
const hadleCloseTicket = () => {
|
const hadleCloseTicket = () => {
|
||||||
closeTicket.mutate(id ? id : '', {
|
closeTicket.mutate(id ? id : '', {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.ticket.list)
|
navigate(Pages.ticket.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0] ?? t('error'), 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Select from '../../../components/Select'
|
|||||||
import Input from '../../../components/Input'
|
import Input from '../../../components/Input'
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import PageLoading from '../../../components/PageLoading'
|
import PageLoading from '../../../components/PageLoading'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
import { useGetWorkspaces } from '../../taskmanager/workspace/hooks/useWorkspaceData'
|
import { useGetWorkspaces } from '../../taskmanager/workspace/hooks/useWorkspaceData'
|
||||||
import { WorkspaceItemType } from '../../taskmanager/workspace/types/WorkspaceTypes'
|
import { WorkspaceItemType } from '../../taskmanager/workspace/types/WorkspaceTypes'
|
||||||
@@ -127,22 +127,22 @@ const CreateTaskFromTicket: FC<Props> = ({ ticketSubject }) => {
|
|||||||
const trimmedTitle = title.trim()
|
const trimmedTitle = title.trim()
|
||||||
|
|
||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
toast.error(t('ticket.select_workspace_required'))
|
toast(t('ticket.select_workspace_required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
toast.error(t('ticket.select_project_required'))
|
toast(t('ticket.select_project_required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taskPhaseId) {
|
if (!taskPhaseId) {
|
||||||
toast.error(t('ticket.select_column_required'))
|
toast(t('ticket.select_column_required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trimmedTitle) {
|
if (!trimmedTitle) {
|
||||||
toast.error(t('errors.required'))
|
toast(t('errors.required'), 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,10 +163,10 @@ const CreateTaskFromTicket: FC<Props> = ({ ticketSubject }) => {
|
|||||||
await updateTask.mutateAsync({ id: taskId, params: { userIds } })
|
await updateTask.mutateAsync({ id: taskId, params: { userIds } })
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.success(t('ticket.create_task_success'))
|
toast(t('ticket.create_task_success'), 'success')
|
||||||
handleClose()
|
handleClose()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error((error as ErrorType).response?.data?.error?.message[0])
|
toast((error as ErrorType).response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import CheckBoxComponent from '../../../components/CheckBoxComponent'
|
|||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import { useReferTicket } from '../hooks/useTicketData'
|
import { useReferTicket } from '../hooks/useTicketData'
|
||||||
import Button from '../../../components/Button'
|
import Button from '../../../components/Button'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../../components/Toast';
|
||||||
import { ErrorType } from '../../../helpers/types'
|
import { ErrorType } from '../../../helpers/types'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -25,10 +25,10 @@ const ReferTicket: FC<Props> = ({ refetch }) => {
|
|||||||
referTicket.mutate({ id: id as string, userId }, {
|
referTicket.mutate({ id: id as string, userId }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
toast.success(t('ticket.refer_ticket_success'))
|
toast(t('ticket.refer_ticket_success'), 'success')
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error.message[0])
|
toast(error.response?.data?.error.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { CreateUserType, RoleItemType } from './types/UserTypes'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { useCreateUser, useGetRoles } from './hooks/useUserData'
|
import { useCreateUser, useGetRoles } from './hooks/useUserData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -27,11 +27,11 @@ const CreateUser: FC = () => {
|
|||||||
const handleCreateUser = (values: CreateUserType) => {
|
const handleCreateUser = (values: CreateUserType) => {
|
||||||
createUser.mutate(values, {
|
createUser.mutate(values, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.users.list)
|
navigate(Pages.users.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ const CreateUser: FC = () => {
|
|||||||
handleCreateUser(values)
|
handleCreateUser(values)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
|||||||
import Textarea from '../../components/Textarea'
|
import Textarea from '../../components/Textarea'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
|
|
||||||
const GroupCreate: FC = () => {
|
const GroupCreate: FC = () => {
|
||||||
@@ -42,11 +42,11 @@ const GroupCreate: FC = () => {
|
|||||||
navigate(Pages.users.groupList)
|
navigate(Pages.users.groupList)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('user.error_count_users'))
|
toast(t('user.error_count_users'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Pages } from '../../config/Pages'
|
|||||||
import { useDeleteUser, useGetUsers } from './hooks/useUserData'
|
import { useDeleteUser, useGetUsers } from './hooks/useUserData'
|
||||||
import { UserItemType } from './types/UserTypes'
|
import { UserItemType } from './types/UserTypes'
|
||||||
import PageLoading from '../../components/PageLoading'
|
import PageLoading from '../../components/PageLoading'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import Pagination from '../../components/Pagination'
|
import Pagination from '../../components/Pagination'
|
||||||
const UsersList: FC = () => {
|
const UsersList: FC = () => {
|
||||||
@@ -24,11 +24,11 @@ const UsersList: FC = () => {
|
|||||||
const handleDeleteUser = (id: string) => {
|
const handleDeleteUser = (id: string) => {
|
||||||
deleteUser.mutate(id, {
|
deleteUser.mutate(id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
getUsers.refetch()
|
getUsers.refetch()
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as Yup from 'yup'
|
|||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const RoleCreate: FC = () => {
|
const RoleCreate: FC = () => {
|
||||||
|
|
||||||
@@ -48,11 +48,11 @@ const RoleCreate: FC = () => {
|
|||||||
navigate(Pages.users.roleList)
|
navigate(Pages.users.roleList)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('user.error_count_permission'))
|
toast(t('user.error_count_permission'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as Yup from 'yup'
|
|||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
|
|
||||||
const RoleUpdate: FC = () => {
|
const RoleUpdate: FC = () => {
|
||||||
|
|
||||||
@@ -46,15 +46,15 @@ const RoleUpdate: FC = () => {
|
|||||||
values.permissions = permissions
|
values.permissions = permissions
|
||||||
updateRole.mutate({ id: id || '', params: values }, {
|
updateRole.mutate({ id: id || '', params: values }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.users.roleList)
|
navigate(Pages.users.roleList)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
toast.error(t('user.error_count_permission'))
|
toast(t('user.error_count_permission'), 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { CreateUserType, RoleItemType } from './types/UserTypes'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||||
import { useGetRoles, useGetUserDetail, useUpdateUser } from './hooks/useUserData'
|
import { useGetRoles, useGetUserDetail, useUpdateUser } from './hooks/useUserData'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from '../../components/Toast';
|
||||||
import { ErrorType } from '../../helpers/types'
|
import { ErrorType } from '../../helpers/types'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { Pages } from '../../config/Pages'
|
import { Pages } from '../../config/Pages'
|
||||||
@@ -28,11 +28,11 @@ const UpdateUser: FC = () => {
|
|||||||
const handleUpdateUser = (values: CreateUserType) => {
|
const handleUpdateUser = (values: CreateUserType) => {
|
||||||
updateUser.mutate({ id: id || '', params: values }, {
|
updateUser.mutate({ id: id || '', params: values }, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('success'))
|
toast(t('success'), 'success')
|
||||||
navigate(Pages.users.list)
|
navigate(Pages.users.list)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ const UpdateUser: FC = () => {
|
|||||||
handleUpdateUser(values)
|
handleUpdateUser(values)
|
||||||
},
|
},
|
||||||
onError: (error: ErrorType) => {
|
onError: (error: ErrorType) => {
|
||||||
toast.error(error.response?.data?.error?.message[0])
|
toast(error.response?.data?.error?.message[0], 'error')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user