Fix: handle crash in error handling of access keys page (#3051)
This commit is contained in:
committed by
GitHub
parent
3e93f7ff88
commit
e7993c2d1b
@@ -47,7 +47,7 @@ import { errorToHandler } from "api/errors";
|
||||
import HelpMenu from "../HelpMenu";
|
||||
import { ACCOUNT_TABLE_COLUMNS } from "./AccountUtils";
|
||||
import { useAppDispatch } from "store";
|
||||
import { ApiError, ServiceAccounts } from "api/consoleApi";
|
||||
import { ServiceAccounts } from "api/consoleApi";
|
||||
import {
|
||||
setErrorSnackMessage,
|
||||
setHelpName,
|
||||
@@ -104,9 +104,12 @@ const Account = () => {
|
||||
const sortedRows = res.data.sort(usersSort);
|
||||
setRecords(sortedRows);
|
||||
})
|
||||
.catch(async (res) => {
|
||||
const err = (await res.json()) as ApiError;
|
||||
dispatch(setErrorSnackMessage(errorToHandler(err)));
|
||||
.catch((res) => {
|
||||
dispatch(
|
||||
setErrorSnackMessage(
|
||||
errorToHandler(res?.error || "Error retrieving access keys"),
|
||||
),
|
||||
);
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import { IAM_PAGES } from "../../../common/SecureComponent/permissions";
|
||||
import { setErrorSnackMessage, setHelpName } from "../../../systemSlice";
|
||||
import { api } from "api";
|
||||
import { errorToHandler } from "api/errors";
|
||||
import { ApiError, ContentType } from "api/consoleApi";
|
||||
import { ContentType } from "api/consoleApi";
|
||||
import CodeMirrorWrapper from "../Common/FormComponents/CodeMirrorWrapper/CodeMirrorWrapper";
|
||||
import AddServiceAccountHelpBox from "./AddServiceAccountHelpBox";
|
||||
import CredentialsPrompt from "../Common/CredentialsPrompt/CredentialsPrompt";
|
||||
@@ -83,10 +83,9 @@ const AddServiceAccount = () => {
|
||||
});
|
||||
})
|
||||
|
||||
.catch(async (res) => {
|
||||
.catch((res) => {
|
||||
setAddSending(false);
|
||||
const err = (await res.json()) as ApiError;
|
||||
dispatch(setErrorSnackMessage(errorToHandler(err)));
|
||||
dispatch(setErrorSnackMessage(errorToHandler(res.error)));
|
||||
});
|
||||
}
|
||||
}, [addSending, setAddSending, dispatch, policyJSON, accessKey, secretKey]);
|
||||
|
||||
Reference in New Issue
Block a user