mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
Resolve notification admin status with config
This commit is contained in:
@@ -12,7 +12,7 @@ import { t } from '@lingui/macro';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { ConfigAPI, MeAPI, RootAPI } from '../../api';
|
import { ConfigAPI, MeAPI, OrganizationsAPI, RootAPI } from '../../api';
|
||||||
import { ConfigProvider } from '../../contexts/Config';
|
import { ConfigProvider } from '../../contexts/Config';
|
||||||
import { SESSION_TIMEOUT_KEY } from '../../constants';
|
import { SESSION_TIMEOUT_KEY } from '../../constants';
|
||||||
import { isAuthenticated } from '../../util/auth';
|
import { isAuthenticated } from '../../util/auth';
|
||||||
@@ -148,8 +148,22 @@ function AppContainer({ i18n, navRouteConfig = [], children }) {
|
|||||||
results: [me],
|
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);
|
setIsReady(true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.response.status === 401) {
|
if (err.response.status === 401) {
|
||||||
|
|||||||
Reference in New Issue
Block a user