/** * WordPress dependencies */ import apiFetch from '@safe-wordpress/api-fetch'; import { dispatch } from '@safe-wordpress/data'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { createErrorNotice } from '@neliosr/utils'; import type { Quota } from '@neliosr/types'; /** * Internal dependencies */ import { store as NSR_DATA } from '../../../store'; export async function getQuota(): Promise< void > { try { const quota = await apiFetch< Quota >( { path: '/neliosr/v1/site/quota', } ); void dispatch( NSR_DATA ).receiveSiteQuota( quota ); } catch ( error ) { createErrorNotice( error, _x( 'Unable to retrieve quota.', 'text', 'nelio-session-recordings' ) ); throw error; } //end try } //end getQuota()