-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hub-react): display error in support tile when api send an error (#…
…14677) ref: MANAGER-16529 Signed-off-by: Jacques Larique <[email protected]>
- Loading branch information
1 parent
c2a14b2
commit 5ed4eca
Showing
3 changed files
with
20 additions
and
14 deletions.
There are no files selected for viewing
10 changes: 7 additions & 3 deletions
10
packages/manager/apps/hub-react/src/data/api/apiHubSupport.ts
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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import { aapi } from '@ovh-ux/manager-core-api'; | ||
import { AxiosResponse } from 'axios'; | ||
import { SupportResponse } from '@/types/support.type'; | ||
import { ApiEnvelope } from '@/types/apiEnvelope.type'; | ||
|
||
export const getHubSupport: ( | ||
cached: boolean, | ||
) => Promise<AxiosResponse<ApiEnvelope<SupportResponse>>> = (cached: boolean) => | ||
aapi.get( | ||
) => Promise<ApiEnvelope<SupportResponse>> = async (cached: boolean) => { | ||
const { data } = await aapi.get<ApiEnvelope<SupportResponse>>( | ||
'/hub/support', | ||
!cached && { | ||
headers: { | ||
Pragma: 'no-cache', | ||
}, | ||
}, | ||
); | ||
if (data?.data?.support?.status === 'ERROR') { | ||
throw new Error(); | ||
} | ||
return data; | ||
}; |
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