-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2915 from Hyperkid123/account-on-hold-error-screen
Catch on hold account error globally.
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { AxiosError } from 'axios'; | ||
import NotAuthorized from '@redhat-cloud-services/frontend-components/NotAuthorized'; | ||
|
||
const ON_HOLD_MARK = 'Insights authorization failed - ERROR_EXPORT_CONTROL:'; | ||
|
||
export const checkAccountOnHold = (error: any) => { | ||
return error?.response?.data?.errors?.[0]?.detail.includes(ON_HOLD_MARK); | ||
}; | ||
|
||
const AccountOnHoldError = ({ error }: { error: AxiosError<{ errors: { detail: string }[] }> }) => { | ||
const data = error.response?.data.errors[0].detail; | ||
const description = <div dangerouslySetInnerHTML={{ __html: data! }}></div>; | ||
return <NotAuthorized description={description} serviceName="Hybrid Cloud Console" />; | ||
}; | ||
|
||
export default AccountOnHoldError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters