diff --git a/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx b/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx index 45bda9ce45..c9575f7421 100644 --- a/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx +++ b/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx @@ -2,6 +2,7 @@ import React from "react"; import { AxiosResponse } from "axios"; import { IApiError } from "interfaces/errors"; import { generateSecretErrMsg } from "pages/SoftwarePage/helpers"; +import CustomLink from "components/CustomLink"; export const parseFile = async (file: File): Promise<[string, string]> => { // get the file name and extension @@ -36,6 +37,34 @@ const generateUnsupportedVariableErrMsg = (errMsg: string) => { : DEFAULT_ERROR_MESSAGE; }; +const generateCAVarsErrMsg = (errMsg: string) => { + return ( + <> + Couldn't add. {errMsg}{" "} + + + ); +}; + +const generateCustomSCEPProfileErrMsg = (errMsg: string) => { + return ( + + Couldn't add. {errMsg}{" "} + + + ); +}; + /** We want to add some additional messageing to some of the error messages so * we add them in this function. Otherwise, we'll just return the error message from the * API. @@ -95,5 +124,21 @@ export const getErrorMessage = (err: AxiosResponse) => { return generateUnsupportedVariableErrMsg(apiReason); } + if ( + apiReason.includes( + "can't be used if variables for SCEP URL and Challenge are not specified" + ) + ) { + return generateCAVarsErrMsg(apiReason); + } + + if ( + apiReason.includes( + "SCEP profile for custom SCEP certificate authority requires" + ) + ) { + return generateCustomSCEPProfileErrMsg(apiReason); + } + return `Couldn't add. ${apiReason}` || DEFAULT_ERROR_MESSAGE; };