File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
x-pack/plugins/infra/public/hooks Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 44 * you may not use this file except in compliance with the Elastic License.
55 */
66
7+ import { boolean } from 'io-ts' ;
8+
79import { useState } from 'react' ;
810import { useKibana } from '../../../../../src/plugins/kibana_react/public' ;
911import { API_BASE_PATH as LICENSE_MANAGEMENT_API_BASE_PATH } from '../../../license_management/common/constants' ;
1012import { useTrackedPromise } from '../utils/use_tracked_promise' ;
13+ import { decodeOrThrow } from '../../common/runtime_types' ;
1114
1215interface UseTrialStatusState {
1316 loadState : 'uninitialized' | 'pending' | 'resolved' | 'rejected' ;
@@ -22,7 +25,8 @@ export function useTrialStatus(): UseTrialStatusState {
2225 const [ loadState , checkTrialAvailability ] = useTrackedPromise (
2326 {
2427 createPromise : async ( ) => {
25- return await services . http . get ( `${ LICENSE_MANAGEMENT_API_BASE_PATH } /start_trial` ) ;
28+ const response = await services . http . get ( `${ LICENSE_MANAGEMENT_API_BASE_PATH } /start_trial` ) ;
29+ return decodeOrThrow ( boolean ) ( response ) ;
2630 } ,
2731 onResolve : ( response ) => {
2832 setIsTrialAvailable ( response ) ;
You can’t perform that action at this time.
0 commit comments