change_error_section
This commit is contained in:
parent
5797659c8e
commit
17d0f70416
|
|
@ -3,6 +3,7 @@ import { QueryStatusEnum } from "../../config/QueryStatus"
|
||||||
import LoadingPage from "../app/LoadingPage"
|
import LoadingPage from "../app/LoadingPage"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { BsEmojiFrown } from "react-icons/bs";
|
import { BsEmojiFrown } from "react-icons/bs";
|
||||||
|
import ErrorPage from "../app/ErrorPage";
|
||||||
|
|
||||||
|
|
||||||
const DashBody = ({ children , status }: { children: React.ReactNode ,status?:QueryStatusEnum }) => {
|
const DashBody = ({ children , status }: { children: React.ReactNode ,status?:QueryStatusEnum }) => {
|
||||||
|
|
@ -17,14 +18,7 @@ const DashBody = ({ children , status }: { children: React.ReactNode ,status?:Qu
|
||||||
// Add Your Custom Error Page
|
// Add Your Custom Error Page
|
||||||
if(status === QueryStatusEnum.ERROR){
|
if(status === QueryStatusEnum.ERROR){
|
||||||
return (
|
return (
|
||||||
<div className="error_show">
|
<ErrorPage/>
|
||||||
<span className="error_icon"><BsEmojiFrown/></span>
|
|
||||||
<span className="error_text">
|
|
||||||
{t("Ops")}...<br/>
|
|
||||||
{t("An Error According")} <br/>
|
|
||||||
{t("Please Try Again Later")}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
40
src/Layout/app/ErrorPage.tsx
Normal file
40
src/Layout/app/ErrorPage.tsx
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { CloseCircleOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Result, Typography } from 'antd';
|
||||||
|
import { useTranslation } from 'react-i18next'; // Import useTranslation hook
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
const { Paragraph, Text } = Typography;
|
||||||
|
|
||||||
|
const ErrorPage: React.FC = () => {
|
||||||
|
const { t } = useTranslation(); // Initialize useTranslation hook
|
||||||
|
const naviagate = useNavigate()
|
||||||
|
|
||||||
|
const handleRefetch = () => {
|
||||||
|
window.location.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleGoToLogin = () => {
|
||||||
|
naviagate("/")
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Result
|
||||||
|
status="error"
|
||||||
|
title={t('errorPage.networkError')}
|
||||||
|
subTitle={t('errorPage.checkAndModify')}
|
||||||
|
extra={[
|
||||||
|
<Button type="primary" key="refetch" onClick={handleRefetch}>
|
||||||
|
{t('errorPage.refetch')} {/* Translate button text */}
|
||||||
|
</Button>,
|
||||||
|
<Button key="goToLogin" onClick={handleGoToLogin}>
|
||||||
|
{t('errorPage.goToHome')} {/* Translate button text */}
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
|
||||||
|
</Result>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ErrorPage;
|
||||||
|
|
@ -7,12 +7,13 @@ function Form() {
|
||||||
return (
|
return (
|
||||||
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
||||||
<Col>
|
<Col>
|
||||||
<ValidationField name="password" />
|
<ValidationField name="new_password" />
|
||||||
|
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
||||||
|
<ValidationField name="old_password" />
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return {
|
return {
|
||||||
// id: objectToEdit?.id ,
|
// id: objectToEdit?.id ,
|
||||||
password: objectToEdit?.password ,
|
new_password: objectToEdit?.password ,
|
||||||
|
old_password: objectToEdit?.old_password ,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,13 @@
|
||||||
"EditDetails": "تعديل التفاصيل",
|
"EditDetails": "تعديل التفاصيل",
|
||||||
"OrderItems": "عناصر الطلب",
|
"OrderItems": "عناصر الطلب",
|
||||||
"reset": "إعادة تعيين",
|
"reset": "إعادة تعيين",
|
||||||
"submit": "إرسال"
|
"submit": "إرسال",
|
||||||
|
"errorPage": {
|
||||||
|
"networkError": "خطأ في الشبكة",
|
||||||
|
"checkAndModify": "يرجى التحقق من الشبكة الخاصة بك وإعادة تحميل الصفحة.",
|
||||||
|
"refetch": "إعادة تحميل الصفحة",
|
||||||
|
"goToHome": "الانتقال إلى الصفحة الرئيسية"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,13 @@
|
||||||
"EditDetails": "Details bearbeiten",
|
"EditDetails": "Details bearbeiten",
|
||||||
"OrderItems": "Bestellpositionen",
|
"OrderItems": "Bestellpositionen",
|
||||||
"reset": "Zurücksetzen",
|
"reset": "Zurücksetzen",
|
||||||
"submit": "Absenden"
|
"submit": "Absenden",
|
||||||
|
"errorPage": {
|
||||||
|
"networkError": "Netzwerkfehler",
|
||||||
|
"checkAndModify": "Bitte überprüfen Sie Ihr Netzwerk und laden Sie die Seite erneut.",
|
||||||
|
"refetch": "Seite neu laden",
|
||||||
|
"goToHome": "Zum Startseite"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,13 @@
|
||||||
"EditDetails": "Edit Details",
|
"EditDetails": "Edit Details",
|
||||||
"OrderItems": "Order Items",
|
"OrderItems": "Order Items",
|
||||||
"reset": "Reset",
|
"reset": "Reset",
|
||||||
"submit": "Submit"
|
"submit": "Submit",
|
||||||
|
"errorPage": {
|
||||||
|
"networkError": "Network Error",
|
||||||
|
"checkAndModify": "Please check your network and refetch the page.",
|
||||||
|
"refetch": "Refetch Page",
|
||||||
|
"goToHome": "Go to Home"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user