import { dispatch, select } from '@safe-wordpress/data'; /** * External dependencies */ import type { AuthorId } from '@nelio-content/types'; /** * Internal dependencies */ import { store as NC_DATA } from '../../../store'; export async function getAuthor( authorId?: AuthorId ): Promise< void > { if ( ! authorId ) { return; } if ( select( NC_DATA ).hasAuthor( authorId ) ) { return; } await dispatch( NC_DATA ).loadAuthors( [ authorId ] ); }