теперь хранится id списка а не его название
Tests / test (push) Successful in 1m33s

This commit is contained in:
gorbenko.pavel
2026-08-03 16:14:31 +05:00
parent c84c2a6cb4
commit 9d9f390548
17 changed files with 421 additions and 92 deletions
@@ -0,0 +1,37 @@
import * as React from 'react';
import { SharePointListsClient } from '../services/sharePointLists';
export interface SharePointListTitleState {
title: string | null;
isLoading: boolean;
}
/** Заголовок списка SharePoint по (site_url, list_id) — для отображения «Название (id)» вместо голого GUID. */
export function useSharePointListTitle(
client: SharePointListsClient | undefined,
siteUrl: string | undefined | null,
listId: string | undefined | null
): SharePointListTitleState {
const [title, setTitle] = React.useState<string | null>(null);
const [isLoading, setIsLoading] = React.useState(false);
React.useEffect(() => {
if (!client || !siteUrl?.trim() || !listId?.trim()) {
setTitle(null);
setIsLoading(false);
return undefined;
}
let cancelled = false;
setIsLoading(true);
client.getListTitle(siteUrl.trim(), listId.trim())
.then(result => { if (!cancelled) setTitle(result); })
.catch(() => { if (!cancelled) setTitle(null); })
.finally(() => { if (!cancelled) setIsLoading(false); });
return () => { cancelled = true; };
}, [client, siteUrl, listId]);
return { title, isLoading };
}