fix_erro_page
This commit is contained in:
parent
17d0f70416
commit
b1c627577d
|
|
@ -1,17 +1,22 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CloseCircleOutlined } from '@ant-design/icons';
|
import { Button, Result } from 'antd';
|
||||||
import { Button, Result, Typography } from 'antd';
|
|
||||||
import { useTranslation } from 'react-i18next'; // Import useTranslation hook
|
import { useTranslation } from 'react-i18next'; // Import useTranslation hook
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
const { Paragraph, Text } = Typography;
|
|
||||||
|
|
||||||
|
import { useQueryClient } from 'react-query';
|
||||||
const ErrorPage: React.FC = () => {
|
const ErrorPage: React.FC = () => {
|
||||||
const { t } = useTranslation(); // Initialize useTranslation hook
|
const { t } = useTranslation(); // Initialize useTranslation hook
|
||||||
const naviagate = useNavigate()
|
const naviagate = useNavigate()
|
||||||
|
const location = useLocation();
|
||||||
|
const queryClient = useQueryClient(); // Initialize useQueryClient hook
|
||||||
|
|
||||||
|
|
||||||
const handleRefetch = () => {
|
const handleRefetch = () => {
|
||||||
window.location.reload();
|
|
||||||
|
const firstPath = location.pathname.split('/')[1]; // Get the first path segment from the URL
|
||||||
|
console.log(firstPath,"firstPath");
|
||||||
|
|
||||||
|
queryClient.invalidateQueries(firstPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGoToLogin = () => {
|
const handleGoToLogin = () => {
|
||||||
|
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
|
|
||||||
import { VENDOR } from "../config/RoleConfige";
|
|
||||||
import { buildFormData } from "./helper/buildFormData";
|
|
||||||
import useAddMutation from "./helper/useAddMutation"
|
|
||||||
import useDeleteMutation from "./helper/useDeleteMutation"
|
|
||||||
import useGetQuery from "./helper/useGetQuery"
|
|
||||||
import useUpdateMutation from "./helper/useUpdateMutation"
|
|
||||||
|
|
||||||
const API = {
|
|
||||||
GET: `/api/admin/account/all`,
|
|
||||||
GET_ALL_PER:`/api/admin/role/all-permissions` ,
|
|
||||||
GET_ALL_ROLE:`/api/admin/role/all` ,
|
|
||||||
ADD: `/api/admin/account/create`,
|
|
||||||
GETWALLET:`/api/admin/account/get-wallet`,
|
|
||||||
UPDATEWALLET:`/api/admin/account/add-to-wallet`,
|
|
||||||
UPDATE: `/api/admin/account/update`,
|
|
||||||
DELETE: `/api/admin/account/delete`,
|
|
||||||
UPDATE_MY_ACCOUNT:`/api/admin/account/update-my-account`,
|
|
||||||
UPDATE_PASSWORD: `/api/admin/account/change-password`,
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
const KEY: string = "ADMINS";
|
|
||||||
const MY_ACCOUNT: string = "MY_ACCOUNT";
|
|
||||||
export const useGetAccounts = (): any => useGetQuery(MY_ACCOUNT, API.GET);
|
|
||||||
export const useGetWallet = (): any => useGetQuery("WALLET", API.GETWALLET);
|
|
||||||
export const useUpdateWallet = (): any => useAddMutation("WALLET", API.UPDATEWALLET);
|
|
||||||
|
|
||||||
export const useAddAccount = (): any => useAddMutation(MY_ACCOUNT, API.ADD);
|
|
||||||
export const useUpdateAccount = (): any => useUpdateMutation(MY_ACCOUNT, API.UPDATE);
|
|
||||||
export const useChangePassword = (): any => useUpdateMutation(MY_ACCOUNT, API.UPDATE_PASSWORD);
|
|
||||||
export const useDeleteAccount = (): any =>useDeleteMutation(MY_ACCOUNT, API.DELETE);
|
|
||||||
|
|
||||||
export const getDataToSend = (values?: any, editMode?: boolean, objectToEdit?: any): any => {
|
|
||||||
const formData = new FormData();
|
|
||||||
const objectToSend = {
|
|
||||||
...values,
|
|
||||||
...(editMode && { account_id: objectToEdit.id }),
|
|
||||||
};
|
|
||||||
if (editMode) {
|
|
||||||
delete objectToSend["password"];
|
|
||||||
delete objectToSend["password_confirmation"];
|
|
||||||
}
|
|
||||||
if(values.role!==VENDOR){
|
|
||||||
delete objectToSend["shop_id"]
|
|
||||||
}
|
|
||||||
|
|
||||||
buildFormData(formData, objectToSend);
|
|
||||||
return formData;
|
|
||||||
};
|
|
||||||
export const useUpdateMyAccount = (): any => useUpdateMutation(MY_ACCOUNT, API.UPDATE_MY_ACCOUNT);
|
|
||||||
|
|
@ -14,7 +14,7 @@ const API = {
|
||||||
UPDATE: `category`,
|
UPDATE: `category`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "CATEGORIES"
|
const KEY = "category"
|
||||||
|
|
||||||
|
|
||||||
export const useGetCategories = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
export const useGetCategories = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const API = {
|
||||||
UPDATE: `coupon`,
|
UPDATE: `coupon`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "COUPON"
|
const KEY = "coupon"
|
||||||
|
|
||||||
|
|
||||||
export const useGetCoupon = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
export const useGetCoupon = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const API = {
|
||||||
UPDATE: `slider`,
|
UPDATE: `slider`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "SLIDER"
|
const KEY = "slider"
|
||||||
|
|
||||||
|
|
||||||
export const useGetSlider = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
export const useGetSlider = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
import useAddMutation from "./helper/useAddMutation"
|
|
||||||
import useDeleteMutation from "./helper/useDeleteMutation"
|
|
||||||
import useGetQuery from "./helper/useGetQuery"
|
|
||||||
import useUpdateMutation from "./helper/useUpdateMutation"
|
|
||||||
|
|
||||||
const API = {
|
|
||||||
ADD: "/api/admin/app-setting/create",
|
|
||||||
GET: `/api/admin/app-setting/all`,
|
|
||||||
UPDATE: `api/admin/app-setting/update`,
|
|
||||||
DELETE: `/api/admin/app-setting/delete`,
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const KEY = "APPSETTING";
|
|
||||||
export const useGetAppSetting = (params?:any) => useGetQuery(KEY, API.GET, params);
|
|
||||||
export const useAddAppSetting = () => useAddMutation(KEY, API.ADD);
|
|
||||||
export const useUpdateAppSetting = () => useUpdateMutation(KEY, API.UPDATE);
|
|
||||||
export const useDeleteAppSetting = () =>useDeleteMutation(KEY, API.DELETE);
|
|
||||||
|
|
@ -14,8 +14,8 @@ const API = {
|
||||||
UPDATE: `attribute`,
|
UPDATE: `attribute`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "ATTRIBUTE"
|
const KEY = "attribute"
|
||||||
const KEYS =['ATTRIBUTE', 'CATEGORIES']
|
const KEYS =['attribute', 'category']
|
||||||
|
|
||||||
export const useGetAttribute = (params?:any) => useGetQueryPagination(KEYS, API.GET_ALL,params);
|
export const useGetAttribute = (params?:any) => useGetQueryPagination(KEYS, API.GET_ALL,params);
|
||||||
// export const useGetOneAttribute = (params?:any) => useGetOneQuery(KEY, API.GET_ALL,params);
|
// export const useGetOneAttribute = (params?:any) => useGetOneQuery(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ const API = {
|
||||||
UPDATE: `attributeValue`,
|
UPDATE: `attributeValue`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "ATTRIBUTEVALUE"
|
const KEY = "attributeValue"
|
||||||
|
|
||||||
|
|
||||||
export const useGetAttributeValue = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
export const useGetAttributeValue = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const API = {
|
||||||
UPDATE: `home/overview`,
|
UPDATE: `home/overview`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "Home"
|
const KEY = "home"
|
||||||
|
|
||||||
|
|
||||||
export const useGetHome = (params?:any) => useGetQuery(KEY, API.GET_ALL,params);
|
export const useGetHome = (params?:any) => useGetQuery(KEY, API.GET_ALL,params);
|
||||||
|
|
@ -13,7 +13,7 @@ const API = {
|
||||||
UPDATE: `order`,
|
UPDATE: `order`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "Order"
|
const KEY = "order"
|
||||||
|
|
||||||
|
|
||||||
export const useGetOrder = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params,{},"coupon");
|
export const useGetOrder = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params,{},"coupon");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ const API = {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "Product"
|
const KEY = "product"
|
||||||
// const ONEKEY = "Product"
|
// const ONEKEY = "Product"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const API = {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "User"
|
const KEY = "users"
|
||||||
|
|
||||||
|
|
||||||
export const useGetUsers = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
export const useGetUsers = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user