2024-10-08 09:31:09: merge [main:da639ea1a284be33cf657a0ef49064e738c334d1];
This commit is contained in:
1 parent
3e52a14c0a
commit
1a1d2b594c
12 files changed
+38
-21
No files matched your search
@@ -8,6 +8,7 @@ import { darkTheme, lightTheme } from '@constants/theme.ts'
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import Routers from '@routes/Routers'
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import './app.scss'
|
||||
|
||||
@@ -23,7 +24,11 @@ const App = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const prevRoute = sessionStorage.getItem('prevRoute')
|
||||
if (location.pathname !== prevRoute) {
|
||||
if (
|
||||
location.pathname !== routePaths.error &&
|
||||
location.pathname !== routePaths.login &&
|
||||
location.pathname !== prevRoute
|
||||
) {
|
||||
sessionStorage.setItem('prevRoute', location.pathname)
|
||||
}
|
||||
}, [location])
|
||||
|
||||
@@ -171,6 +171,7 @@ const ApplicationsContent: FC<ApplicationsContentPropTypes> = ({
|
||||
<section className="applications-content">
|
||||
<Column
|
||||
title="Приложения"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={true}
|
||||
onAddItem={addApplicationModal}
|
||||
|
||||
@@ -82,6 +82,7 @@ const AppAccessPage = () => {
|
||||
<section className="app-access-page">
|
||||
<Column
|
||||
title="Приложения"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
showUpdateBtn={false}
|
||||
showAddBtn={false}
|
||||
showRemoveBtn={false}
|
||||
|
||||
@@ -163,6 +163,7 @@ const ApplicationsPage = () => {
|
||||
<main className="applications-page">
|
||||
<Column
|
||||
title="Группы приложений"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
onUpdateItem={updateApplicationModal}
|
||||
showUpdateBtn={true}
|
||||
onAddItem={addApplicationModal}
|
||||
|
||||
@@ -38,7 +38,7 @@ const LoginPage = () => {
|
||||
}
|
||||
|
||||
const handleError = (err: AxiosError<MSPError>): void => {
|
||||
const { response,status } = err
|
||||
const { response, status } = err
|
||||
if (response && status === 401) {
|
||||
setFormError(response.statusText, messages.loginError)
|
||||
} else {
|
||||
@@ -57,9 +57,8 @@ const LoginPage = () => {
|
||||
LocalStorage.set(localStorageKeys.HEADER_NAME, response.headerName)
|
||||
LocalStorage.set(localStorageKeys.USER_TOKEN, response.token)
|
||||
const redirectUrl =
|
||||
localStorage.getItem('redirectUrl') || routePaths.home
|
||||
sessionStorage.getItem('prevRoute') || routePaths.home
|
||||
navigate(redirectUrl, { replace: true })
|
||||
localStorage.removeItem('redirectUrl')
|
||||
})
|
||||
.catch((err: AxiosError<MSPError>) => handleError(err))
|
||||
}
|
||||
@@ -106,15 +105,15 @@ const LoginPage = () => {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<section className="login-page">
|
||||
<form className="login-page__content">
|
||||
<h1 data-cy="login-title" className="login-page__content__title">
|
||||
Вход в систему
|
||||
</h1>
|
||||
<Divider />
|
||||
{renderInternalAuthForm()}
|
||||
</form>
|
||||
</section>
|
||||
<section className="login-page">
|
||||
<form className="login-page__content">
|
||||
<h1 data-cy="login-title" className="login-page__content__title">
|
||||
Вход в систему
|
||||
</h1>
|
||||
<Divider />
|
||||
{renderInternalAuthForm()}
|
||||
</form>
|
||||
</section>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ const ModulesPage = () => {
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const { data: ModulesList = [], isLoading: isModulesLoading } =
|
||||
modulesServiceApi.useGetModulesQuery('modules', {
|
||||
pollingInterval: 1000,
|
||||
pollingInterval: 5000,
|
||||
skipPollingIfUnfocused: true
|
||||
})
|
||||
const [removeModule] = modulesServiceApi.useRemoveModuleMutation()
|
||||
@@ -190,6 +190,8 @@ const ModulesPage = () => {
|
||||
return (
|
||||
<section className="modules-page">
|
||||
<Column
|
||||
title="Модули"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
items={filterFirstColumnItems(ModulesList, searchValue)}
|
||||
showAddBtn={false}
|
||||
showUpdateBtn={false}
|
||||
|
||||
@@ -11,7 +11,7 @@ const NotFound = () => {
|
||||
const navigate = useNavigate()
|
||||
return (
|
||||
<NotFoundPage>
|
||||
<Button type="primary" onClick={() => navigate(routePaths.modules)}>
|
||||
<Button type="primary" onClick={() => navigate(routePaths.home)}>
|
||||
На главную
|
||||
</Button>
|
||||
</NotFoundPage>
|
||||
|
||||
@@ -192,6 +192,8 @@ const RolesPage = () => {
|
||||
return (
|
||||
<section className="roles-page">
|
||||
<Column
|
||||
title="Роли пользователей"
|
||||
searchPlaceholder="Введите имя или id"
|
||||
showUpdateBtn={false}
|
||||
items={filterFirstColumnItems(data, searchValue)}
|
||||
showAddBtn={isAddRolePermissions}
|
||||
|
||||
@@ -41,8 +41,9 @@ apiService.interceptors.response.use(
|
||||
console.error(error)
|
||||
if (error.response && error.response.status === 401) {
|
||||
localClear()
|
||||
const prevRoute = sessionStorage.getItem('prevRoute') || ''
|
||||
message.error('Ваша сессия истекла"').then()
|
||||
LocalStorage.set('redirectUrl', location.pathname)
|
||||
sessionStorage.setItem('prevRoute', prevRoute)
|
||||
window.location.href = routePaths.login
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user