refactor
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { isPlainObject, isStringValue } from '../../utils/typeGuards';
|
||||
|
||||
type ApiClient = {
|
||||
post: (path: string, body?: unknown) => Promise<{ data: unknown }>;
|
||||
@@ -99,10 +100,10 @@ const useDocumentCorrespondentActions = ({
|
||||
if (!option) {
|
||||
return null;
|
||||
}
|
||||
if (typeof option === 'object' && 'id' in option) {
|
||||
if (isPlainObject(option) && 'id' in option) {
|
||||
return option as CorrespondentOption;
|
||||
}
|
||||
if (typeof option === 'string') {
|
||||
if (isStringValue(option)) {
|
||||
const trimmed = option.trim();
|
||||
if (trimmed) {
|
||||
return { id: null, name: trimmed };
|
||||
|
||||
Reference in New Issue
Block a user