LFFE-5 improvement of middleware
This commit is contained in:
33
src/core/components/Middleware/RolePermissionComponent.jsx
Normal file
33
src/core/components/Middleware/RolePermissionComponent.jsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {NextLinkComposed} from "@/core/components/LinkRouting";
|
||||
import Message from "@/core/components/Messages";
|
||||
|
||||
const RolePermissionComponent = () => {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<Message
|
||||
text={
|
||||
<Typography sx={{ textAlign: "center" }}>
|
||||
{t("Permission.typography_you_dont_have_access")}
|
||||
</Typography>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
variant="contained"
|
||||
component={NextLinkComposed}
|
||||
to={{
|
||||
pathname: "/dashboard",
|
||||
}}
|
||||
>
|
||||
{t("Permission.button_back_dashboard")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RolePermissionComponent;
|
||||
36
src/core/components/Middleware/WithAuthComponent.jsx
Normal file
36
src/core/components/Middleware/WithAuthComponent.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { useRouter } from "next/router";
|
||||
import Message from "@/core/components/Messages";
|
||||
import { NextLinkComposed } from "@/core/components/LinkRouting";
|
||||
import {useTranslations} from "next-intl";
|
||||
|
||||
const WithAuthComponent = () => {
|
||||
const router = useRouter();
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<Message
|
||||
text={
|
||||
<Typography sx={{ textAlign: "center" }}>
|
||||
{t("Authorization.typography_your_access_to_this_page_has_expired_Please_login_again")}
|
||||
</Typography>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
variant="contained"
|
||||
component={NextLinkComposed}
|
||||
to={{
|
||||
pathname: "/login-expert",
|
||||
query: {back_url: encodeURIComponent(router.asPath)},
|
||||
}}
|
||||
>
|
||||
{t("login")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default WithAuthComponent;
|
||||
25
src/core/components/Middleware/WithoutAuthComponent.jsx
Normal file
25
src/core/components/Middleware/WithoutAuthComponent.jsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import {Stack, Typography} from "@mui/material";
|
||||
import Message from "@/core/components/Messages";
|
||||
import {useTranslations} from "next-intl";
|
||||
const WithoutAuthComponent = ({ backUrlDecodedPath }) => {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<Message
|
||||
text={
|
||||
<Stack alignItems="center" spacing={2}>
|
||||
<Typography sx={{ textAlign: "center" }}>
|
||||
{t("Authorization.typography_your_login_is_valid_and_you_do_not_need_to_login_again")}
|
||||
</Typography>
|
||||
<Typography>
|
||||
{t("Authorization.typography_redirect_to")}{" "}
|
||||
{backUrlDecodedPath
|
||||
? t("Authorization.typography_routing_previuos_page")
|
||||
: t("Authorization.typography_routing_dashbaord_page")}
|
||||
</Typography>
|
||||
</Stack>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default WithoutAuthComponent;
|
||||
Reference in New Issue
Block a user