fix: use useAppAuth for getting auth fields
This commit is contained in:
@@ -8,23 +8,25 @@ import { UPDATE_APP_AUTH_CLIENT } from 'graphql/mutations/update-app-auth-client
|
|||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
||||||
import useAdminAppAuthClient from 'hooks/useAdminAppAuthClient.ee';
|
import useAdminAppAuthClient from 'hooks/useAdminAppAuthClient.ee';
|
||||||
|
import useAppAuth from 'hooks/useAppAuth';
|
||||||
|
|
||||||
function AdminApplicationUpdateAuthClient(props) {
|
function AdminApplicationUpdateAuthClient(props) {
|
||||||
const { application, onClose } = props;
|
const { application, onClose } = props;
|
||||||
const { auth } = application;
|
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { clientId } = useParams();
|
const { clientId } = useParams();
|
||||||
|
|
||||||
const { data: adminAppAuthClient, isLoading: isAdminAuthClientLoading } =
|
const { data: adminAppAuthClient, isLoading: isAdminAuthClientLoading } =
|
||||||
useAdminAppAuthClient(clientId);
|
useAdminAppAuthClient(clientId);
|
||||||
|
|
||||||
|
const { data: auth } = useAppAuth(application.key);
|
||||||
|
|
||||||
const [updateAppAuthClient, { loading: loadingUpdateAppAuthClient, error }] =
|
const [updateAppAuthClient, { loading: loadingUpdateAppAuthClient, error }] =
|
||||||
useMutation(UPDATE_APP_AUTH_CLIENT, {
|
useMutation(UPDATE_APP_AUTH_CLIENT, {
|
||||||
refetchQueries: ['GetAppAuthClients'],
|
refetchQueries: ['GetAppAuthClients'],
|
||||||
context: { autoSnackbar: false },
|
context: { autoSnackbar: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
const authFields = auth?.fields?.map((field) => ({
|
const authFields = auth?.data?.fields?.map((field) => ({
|
||||||
...field,
|
...field,
|
||||||
required: false,
|
required: false,
|
||||||
}));
|
}));
|
||||||
|
Reference in New Issue
Block a user