/** * WordPress dependencies */ import apiFetch from '@safe-wordpress/api-fetch'; import { dispatch } from '@safe-wordpress/data'; /** * Internal dependencies */ import { store as NSR_DATA } from '../../../store'; export async function getRecordingStatus(): Promise< void > { try { const status = await apiFetch< boolean >( { method: 'GET', path: '/neliosr/v1/recording-status', } ); await dispatch( NSR_DATA ).receiveRecordingStatus( status ); } catch ( error ) { const message = error instanceof Error ? error.message : 'unknown'; // eslint-disable-next-line console.warn( `Unable to retrieve recording status. Error: ${ message }` ); } //end try } //end getRecordingStatus() export async function getActivePlugins(): Promise< void > { try { const plugins = await apiFetch< ReadonlyArray< string > >( { path: '/neliosr/v1/plugins', } ); await dispatch( NSR_DATA ).receivePlugins( plugins ); } catch ( error ) { const message = error instanceof Error ? error.message : 'unknown'; // eslint-disable-next-line console.warn( `Unable to retrieve active plugins. Error: ${ message }` ); } //end try } //end getActivePlugins()