MSP-3125 fix style
This commit is contained in:
1 parent
654490c748
commit
602f703f5d
29 files changed
+151
-229
No files matched your search
+10
-10
@@ -1,16 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Vite + React + TS</title>
|
||||
<script>
|
||||
window.AppVersion = '<%=APP_VERSION%>';
|
||||
window.AppVersion = "<%=APP_VERSION%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,8 @@
|
||||
import {PropsWithChildren} from 'react';
|
||||
import useRole from "../../hooks/useRole.tsx";
|
||||
import {PermissionKeys} from "../../types/roles.type.ts";
|
||||
import useRole from '../../hooks/useRole.tsx';
|
||||
import {PermissionKeys} from '../../types/roles.type.ts';
|
||||
|
||||
function AdminPermission({children}: PropsWithChildren) {
|
||||
const AdminPermission = ({children}: PropsWithChildren) => {
|
||||
const {hasPermission} = useRole();
|
||||
|
||||
if (hasPermission(PermissionKeys.admin_view)) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {useState} from 'react';
|
||||
import {ConfigProvider} from "antd";
|
||||
import {Context} from "../store";
|
||||
import Routers from "./Routers";
|
||||
import {lightTheme} from "../constants/theme.ts";
|
||||
import {ConfigProvider} from 'antd';
|
||||
import {Context} from '../store';
|
||||
import Routers from './Routers';
|
||||
import {lightTheme} from '../constants/theme.ts';
|
||||
import './app.scss'
|
||||
|
||||
function App() {
|
||||
const App = () => {
|
||||
const [themes, setTheme] = useState(lightTheme);
|
||||
|
||||
return (
|
||||
@@ -20,4 +20,3 @@ function App() {
|
||||
}
|
||||
|
||||
export default App
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
const ErrorPage = () => {
|
||||
|
||||
return (
|
||||
<div className='error-page'>
|
||||
<div>Извините, ошибка</div>
|
||||
</div>
|
||||
);
|
||||
<section className="error-page">
|
||||
<p>Извините, ошибка</p>
|
||||
</section>
|
||||
)
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
||||
@@ -3,4 +3,4 @@
|
||||
border: none;
|
||||
display: flex;
|
||||
justify-content: end
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
import {useContext} from "react";
|
||||
import {Segmented, theme} from "antd";
|
||||
import {Context} from "../../store";
|
||||
import {darkTheme, lightTheme} from "../../constants/theme.ts";
|
||||
import {useContext} from 'react';
|
||||
import {Segmented, theme} from 'antd';
|
||||
import {Context} from '../../store';
|
||||
import {darkTheme, lightTheme} from '../../constants/theme.ts';
|
||||
import './header.scss'
|
||||
|
||||
const options = [
|
||||
{label: 'Light', value: 'light' },
|
||||
{label: 'Dark', value: 'dark'},
|
||||
{label: "Light", value: "light"},
|
||||
{label: "Dark", value: "dark"},
|
||||
];
|
||||
|
||||
function Header() {
|
||||
const Header = () => {
|
||||
const {setTheme} = useContext(Context)
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
const {useToken} = theme;
|
||||
const {token} = useToken();
|
||||
|
||||
return <header className='header' style={{
|
||||
backgroundColor: token.colorBgLayout
|
||||
}}><Segmented onChange={(v) => setTheme(v === 'light' ? lightTheme : darkTheme)} options={options}/></header>;
|
||||
return <header className="header" style={{backgroundColor: token.colorBgLayout}}>
|
||||
<Segmented onChange={(v) => setTheme(v === "light" ? lightTheme : darkTheme)} options={options}/>
|
||||
</header>;
|
||||
}
|
||||
|
||||
export default Header;
|
||||
export default Header;
|
||||
@@ -1,16 +1,16 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {useEffect, useState} from 'react';
|
||||
import {Navigate, Outlet, useNavigate} from 'react-router-dom';
|
||||
import {Menu} from 'antd';
|
||||
import Header from "../Header";
|
||||
import useRole from "../../hooks/useRole.tsx";
|
||||
import {PermissionKeys} from "../../types/roles.type.ts";
|
||||
import {MenuItemKeys, menuKeys} from "../../types/layout.type.ts";
|
||||
import {routePaths} from "../../constants/routes.ts";
|
||||
import {StateProfileStatus} from "../../redusers/ProfileSlice.ts";
|
||||
import {useAppSelector} from "../../hooks/redux.ts";
|
||||
import Header from '../Header';
|
||||
import useRole from '../../hooks/useRole.tsx';
|
||||
import {PermissionKeys} from '../../types/roles.type.ts';
|
||||
import {MenuItemKeys, menuKeys} from '../../types/layout.type.ts';
|
||||
import {routePaths} from '../../constants/routes.ts';
|
||||
import {StateProfileStatus} from '../../redusers/ProfileSlice.ts';
|
||||
import {useAppSelector} from '../../hooks/redux.ts';
|
||||
import './layout.scss'
|
||||
|
||||
function Layout() {
|
||||
const Layout = () => {
|
||||
const {hasPermission} = useRole();
|
||||
const navigate = useNavigate();
|
||||
const {status} = useAppSelector((state) => state.profileReducer);
|
||||
@@ -19,32 +19,31 @@ function Layout() {
|
||||
const [selectedMenuKeys, setSelectedMenuKeys] = useState<MenuItemKeys[]>([]);
|
||||
|
||||
const hideItem = (permission: PermissionKeys | PermissionKeys[]) => {
|
||||
|
||||
if (Array.isArray(permission)) {
|
||||
const result = permission.reduce((acc, currentValue) => {
|
||||
const isHasPermission = hasPermission(currentValue);
|
||||
return isHasPermission || acc;
|
||||
}, false);
|
||||
return result ? '' : 'hide-item';
|
||||
return result ? "" : "hide-item";
|
||||
}
|
||||
return hasPermission(permission) ? '' : 'hide-item';
|
||||
return hasPermission(permission) ? "" : "hide-item";
|
||||
};
|
||||
|
||||
const menuItems = [
|
||||
{
|
||||
label: 'Profile',
|
||||
key: 'users',
|
||||
label: "Profile",
|
||||
key: "users",
|
||||
className: hideItem(PermissionKeys.user_view),
|
||||
},
|
||||
{
|
||||
label: 'Profile2',
|
||||
key: 'roles',
|
||||
label: "Profile2",
|
||||
key: "roles",
|
||||
className: hideItem(PermissionKeys.user_view),
|
||||
}
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
const menuKey = location.pathname.split('/')[1] as MenuItemKeys;
|
||||
const menuKey = location.pathname.split("/")[1] as MenuItemKeys;
|
||||
|
||||
const menuItem = menuKeys[menuKey];
|
||||
|
||||
@@ -65,11 +64,13 @@ function Layout() {
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
if (status === StateProfileStatus.rejected) {
|
||||
return <Navigate to={routePaths.error} replace/>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='layout'>
|
||||
<section className="layout">
|
||||
<Header/>
|
||||
<Menu
|
||||
onOpenChange={(keys) => setOpenKeys(keys)}
|
||||
@@ -81,8 +82,8 @@ function Layout() {
|
||||
items={menuItems}
|
||||
/>
|
||||
<Outlet/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default Layout;
|
||||
export default Layout;
|
||||
@@ -1,4 +1,4 @@
|
||||
.layout {
|
||||
min-height: calc(100vh - 96px);
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import {Button, theme} from 'antd';
|
||||
import {PermissionKeys} from "../../types/roles.type.ts";
|
||||
import useRole from "../../hooks/useRole.tsx";
|
||||
import './main.scss'
|
||||
|
||||
const Main = () => {
|
||||
const {hasPermission} = useRole();
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeys.user_view);
|
||||
|
||||
return (
|
||||
<div className='main' style={{
|
||||
backgroundColor: token.colorBgLayout
|
||||
}}>
|
||||
{isPageAvailable && <Button ghost type='primary'>
|
||||
Border
|
||||
</Button>}
|
||||
<div>Проверка шрифтов</div>
|
||||
<Button type='primary'>Primary</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Main;
|
||||
@@ -1,18 +1,17 @@
|
||||
import {Navigate, Outlet, useLocation} from 'react-router-dom';
|
||||
import {LocalStorage} from "../../utils/localStorageUtils.ts";
|
||||
import {localStorageKeys} from "../../constants/localStorageKeys.ts";
|
||||
import {routePaths} from "../../constants/routes.ts";
|
||||
import {LocalStorage} from '../../utils/localStorageUtils.ts';
|
||||
import {localStorageKeys} from '../../constants/localStorageKeys.ts';
|
||||
import {routePaths} from '../../constants/routes.ts';
|
||||
|
||||
function PrivateRoute() {
|
||||
const PrivateRoute = () => {
|
||||
const location = useLocation();
|
||||
const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN);
|
||||
|
||||
if (!userToken) {
|
||||
LocalStorage.set('redirectUrl', location.pathname)
|
||||
LocalStorage.set("redirectUrl", location.pathname)
|
||||
return (
|
||||
<Navigate
|
||||
to={routePaths.login}
|
||||
// state={{ from: location.pathname }}
|
||||
replace
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import {Route, Routes} from 'react-router-dom';
|
||||
import {App} from 'antd';
|
||||
import HomePages from "../../pages/HomePage";
|
||||
import ErrorPage from "../ErrorPage";
|
||||
import PrivateRoute from "../PrivateRoute";
|
||||
import LoginPage from "../../pages/LoginPage";
|
||||
import Layout from "../Layout";
|
||||
|
||||
function Routers() {
|
||||
import HomePages from '../../pages/HomePage';
|
||||
import ErrorPage from '../ErrorPage';
|
||||
import PrivateRoute from '../PrivateRoute';
|
||||
import LoginPage from '../../pages/LoginPage';
|
||||
import Layout from '../Layout';
|
||||
|
||||
const Routers = () => {
|
||||
return (
|
||||
<App>
|
||||
<Routes>
|
||||
@@ -24,4 +23,3 @@ function Routers() {
|
||||
}
|
||||
|
||||
export default Routers
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
#root {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.ant-space-item {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
type LocalStorageKeys = 'HEADER_NAME' | 'USER_TOKEN';
|
||||
type LocalStorageKeys = "HEADER_NAME" | "USER_TOKEN";
|
||||
|
||||
export const localStorageKeys: Record<LocalStorageKeys, string> = {
|
||||
HEADER_NAME: 'HEADER_NAME',
|
||||
USER_TOKEN: 'USER_TOKEN'
|
||||
HEADER_NAME: "HEADER_NAME",
|
||||
USER_TOKEN: "USER_TOKEN"
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {useMemo} from 'react';
|
||||
import {useAppSelector} from "./redux.ts";
|
||||
import {PermissionKeys} from "../types/roles.type.ts";
|
||||
import {useAppSelector} from './redux.ts';
|
||||
import {PermissionKeys} from '../types/roles.type.ts';
|
||||
|
||||
export const useRole = () => {
|
||||
const {profile} = useAppSelector((state: any) => state.profileReducer);
|
||||
|
||||
+2
-62
@@ -1,64 +1,4 @@
|
||||
:root {
|
||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import {BrowserRouter} from 'react-router-dom';
|
||||
import {setupListeners} from "@reduxjs/toolkit/query";
|
||||
import {setupListeners} from '@reduxjs/toolkit/query';
|
||||
import {Provider} from 'react-redux';
|
||||
import App from './components/App.tsx'
|
||||
import {setupStore} from "./store";
|
||||
import {setupStore} from './store';
|
||||
import './index.css'
|
||||
|
||||
const store = setupStore();
|
||||
setupListeners(store.dispatch);
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<Provider store={store}>
|
||||
<BrowserRouter>
|
||||
<App/>
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,24 @@
|
||||
import Main from "../../components/Main";
|
||||
import {Button, theme} from 'antd';
|
||||
import useRole from '../../hooks/useRole.tsx';
|
||||
import {PermissionKeys} from '../../types/roles.type.ts';
|
||||
import './home.scss'
|
||||
|
||||
function HomePages() {
|
||||
return <Main/>
|
||||
}
|
||||
const HomePages = () => {
|
||||
const {hasPermission} = useRole();
|
||||
const {useToken} = theme;
|
||||
const {token} = useToken();
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeys.user_view);
|
||||
|
||||
return (
|
||||
<main className="main" style={{backgroundColor: token.colorBgLayout}}>
|
||||
{isPageAvailable && <Button ghost type="primary">
|
||||
Border
|
||||
</Button>}
|
||||
<div>Проверка шрифтов</div>
|
||||
<Button type="primary">Primary</Button>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
export default HomePages;
|
||||
@@ -1,20 +1,20 @@
|
||||
import {useNavigate} from "react-router-dom";
|
||||
import {useNavigate} from 'react-router-dom';
|
||||
|
||||
function LoginPage() {
|
||||
const LoginPage = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<div className='login-page'>
|
||||
<main className="login-page">
|
||||
<button onClick={() => {
|
||||
const url = localStorage.getItem('redirectUrl')
|
||||
const url = localStorage.getItem("redirectUrl")
|
||||
if (url) {
|
||||
navigate(url)
|
||||
localStorage.removeItem('redirectUrl')
|
||||
localStorage.removeItem("redirectUrl")
|
||||
}
|
||||
}}>Зарегистрироваться
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default LoginPage;
|
||||
export default LoginPage;
|
||||
@@ -1,4 +1,4 @@
|
||||
.login-page {
|
||||
display: flex;
|
||||
justify-content: center
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import {createAsyncThunk} from '@reduxjs/toolkit';
|
||||
import {ProfileDataType} from "../types/profile.type.ts";
|
||||
import {apiService} from "../services/apiService.ts";
|
||||
import {apiPaths} from "../constants/api/apiPaths.ts";
|
||||
import {ProfileDataType} from '../types/profile.type.ts';
|
||||
import {apiService} from '../services/apiService.ts';
|
||||
import {apiPaths} from '../constants/api/apiPaths.ts';
|
||||
|
||||
export const fetchProfile = createAsyncThunk(
|
||||
'profile/fetchProfile',
|
||||
"profile/fetchProfile",
|
||||
async (_, {rejectWithValue}) => {
|
||||
try {
|
||||
const response = await apiService.post<ProfileDataType>(
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import {PayloadAction, createSlice, ActionReducerMapBuilder} from '@reduxjs/toolkit';
|
||||
import {ProfileDataType, ProfileType} from "../types/profile.type.ts";
|
||||
import {fetchProfile} from "./ActionCreators.ts";
|
||||
import {ProfileDataType, ProfileType} from '../types/profile.type.ts';
|
||||
import {fetchProfile} from './ActionCreators.ts';
|
||||
|
||||
export enum StateProfileStatus {
|
||||
resolved = 'resolved',
|
||||
pending = 'pending',
|
||||
rejected = 'rejected',
|
||||
notInit = 'notInit',
|
||||
resolved = "resolved",
|
||||
pending = "pending",
|
||||
rejected = "rejected",
|
||||
notInit = "notInit",
|
||||
}
|
||||
|
||||
export const initialState: ProfileType = {
|
||||
profile: {
|
||||
email: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
role: '',
|
||||
email: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
role: "",
|
||||
roles: [],
|
||||
permissions: [],
|
||||
idleTimeoutMs: 0,
|
||||
},
|
||||
status: StateProfileStatus.notInit,
|
||||
error: '',
|
||||
error: "",
|
||||
};
|
||||
|
||||
export const profileSlice = createSlice({
|
||||
name: 'profile',
|
||||
name: "profile",
|
||||
initialState,
|
||||
reducers: {
|
||||
clearProfile(state) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {message} from 'antd';
|
||||
import axios, {AxiosError} from 'axios';
|
||||
import {LocalStorage} from "../utils/localStorageUtils.ts";
|
||||
import {getConfigProperty} from "../utils/configUtils.ts";
|
||||
import {MSPError} from "../types";
|
||||
import {routePaths} from "../constants/routes.ts";
|
||||
import {localStorageKeys} from "../constants/localStorageKeys.ts";
|
||||
import {LocalStorage} from '../utils/localStorageUtils.ts';
|
||||
import {getConfigProperty} from '../utils/configUtils.ts';
|
||||
import {MSPError} from '../types';
|
||||
import {routePaths} from '../constants/routes.ts';
|
||||
import {localStorageKeys} from '../constants/localStorageKeys.ts';
|
||||
|
||||
export const apiService = axios.create({
|
||||
timeout: 15000,
|
||||
data: {},
|
||||
});
|
||||
|
||||
apiService.defaults.headers.post['X-APPLICATION-TOKEN'] = getConfigProperty(
|
||||
'APP_TOKEN',
|
||||
apiService.defaults.headers.post["X-APPLICATION-TOKEN"] = getConfigProperty(
|
||||
"APP_TOKEN",
|
||||
import.meta.env.APP_TOKEN,
|
||||
);
|
||||
|
||||
@@ -35,7 +35,7 @@ apiService.interceptors.response.use(
|
||||
}
|
||||
|
||||
if (error.response && error.response.status === 500) {
|
||||
message.error('Внутренняя ошибка сервиса').then();
|
||||
message.error("Внутренняя ошибка сервиса").then();
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
||||
+4
-3
@@ -1,10 +1,11 @@
|
||||
import {Dispatch, SetStateAction, createContext} from 'react'
|
||||
import {combineReducers, configureStore} from '@reduxjs/toolkit';
|
||||
import {theme} from "antd";
|
||||
import {theme} from 'antd';
|
||||
import {MapToken, SeedToken} from 'antd/es/theme/interface';
|
||||
import profileReducer from '../redusers/ProfileSlice.ts';
|
||||
|
||||
export interface ContextProps {
|
||||
setTheme: Dispatch<SetStateAction<any>>
|
||||
setTheme: Dispatch<SetStateAction<{ algorithm: (token: SeedToken) => MapToken }>>
|
||||
}
|
||||
|
||||
export const Context = createContext<ContextProps>({
|
||||
@@ -22,4 +23,4 @@ export const setupStore = () =>
|
||||
|
||||
export type RootState = ReturnType<typeof rootReducer>;
|
||||
export type AppStore = ReturnType<typeof setupStore>;
|
||||
export type AppDispatch = AppStore['dispatch'];
|
||||
export type AppDispatch = AppStore["dispatch"];
|
||||
@@ -1,8 +1,8 @@
|
||||
import {MenuProps} from 'antd';
|
||||
|
||||
export enum MenuItemKeys {
|
||||
users = 'users',
|
||||
roles = 'roles',
|
||||
users = "users",
|
||||
roles = "roles",
|
||||
}
|
||||
|
||||
type MenuItem = {
|
||||
@@ -12,12 +12,12 @@ type MenuItem = {
|
||||
export const menuKeys: Record<MenuItemKeys, MenuItem> = {
|
||||
[MenuItemKeys.users]: {
|
||||
key: MenuItemKeys.users,
|
||||
parent: ['sessionManagement'],
|
||||
parent: ["sessionManagement"],
|
||||
},
|
||||
[MenuItemKeys.roles]: {
|
||||
key: MenuItemKeys.roles,
|
||||
parent: ['sessionManagement'],
|
||||
parent: ["sessionManagement"],
|
||||
},
|
||||
};
|
||||
|
||||
export type MenuItemType = Required<MenuProps>['items'][number];
|
||||
export type MenuItemType = Required<MenuProps>["items"][number];
|
||||
@@ -1,4 +1,4 @@
|
||||
import {StateProfileStatus} from "../redusers/ProfileSlice.ts";
|
||||
import {StateProfileStatus} from '../redusers/ProfileSlice.ts';
|
||||
|
||||
export type ProfileDataType = {
|
||||
email: string;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export enum RoleKeys {
|
||||
user = 'user',
|
||||
admin = 'admin',
|
||||
user = "user",
|
||||
admin = "admin",
|
||||
}
|
||||
|
||||
export enum PermissionKeys {
|
||||
user_view = 'user_view', // Просмотр списка пользователей
|
||||
admin_view = 'admin_view', // роль суперадмина, требуется для интерфейса
|
||||
user_view = "user_view", // Просмотр списка пользователей
|
||||
admin_view = "admin_view", // роль суперадмина, требуется для интерфейса
|
||||
}
|
||||
|
||||
export type ConfigRoles = {
|
||||
@@ -30,7 +30,7 @@ export type RoleType = {
|
||||
exclusive: boolean;
|
||||
};
|
||||
|
||||
export type NewRoleType = Omit<RoleType, 'id' | 'createdAt' | 'updatedAt'>;
|
||||
export type NewRoleType = Omit<RoleType, "id" | "createdAt" | "updatedAt">;
|
||||
|
||||
export type PermissionType = {
|
||||
key: PermissionKeys;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const LocalStorage = {
|
||||
set(key: string, value: any): void {
|
||||
const item = typeof value === 'string' ? value : JSON.stringify(value);
|
||||
const item = typeof value === "string" ? value : JSON.stringify(value);
|
||||
localStorage.setItem(key, item);
|
||||
},
|
||||
get(key: string): any | null {
|
||||
|
||||
Reference in new issue
Block a user