mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Resolve notification admin status with config
This commit is contained in:
parent
d3f2dedbd5
commit
5d9d486f9c
@ -12,7 +12,7 @@ import { t } from '@lingui/macro';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { ConfigAPI, MeAPI, RootAPI } from '../../api';
|
||||
import { ConfigAPI, MeAPI, OrganizationsAPI, RootAPI } from '../../api';
|
||||
import { ConfigProvider } from '../../contexts/Config';
|
||||
import { SESSION_TIMEOUT_KEY } from '../../constants';
|
||||
import { isAuthenticated } from '../../util/auth';
|
||||
@ -148,8 +148,22 @@ function AppContainer({ i18n, navRouteConfig = [], children }) {
|
||||
results: [me],
|
||||
},
|
||||
},
|
||||
] = await Promise.all([ConfigAPI.read(), MeAPI.read()]);
|
||||
setConfig({ ...data, me });
|
||||
{
|
||||
data: { results: notificationAdminResults },
|
||||
},
|
||||
] = await Promise.all([
|
||||
ConfigAPI.read(),
|
||||
MeAPI.read(),
|
||||
OrganizationsAPI.read({
|
||||
page_size: 1,
|
||||
role_level: 'notification_admin_role',
|
||||
}),
|
||||
]);
|
||||
setConfig({
|
||||
...data,
|
||||
me,
|
||||
isNotificationAdmin: Boolean(notificationAdminResults?.length),
|
||||
});
|
||||
setIsReady(true);
|
||||
} catch (err) {
|
||||
if (err.response.status === 401) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user