Управление заявками (#7)
Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz> Reviewed-on: http://git.tnsu.kz/gorbenko.pavel/tnsu-approval-route/pulls/7
This commit was merged in pull request #7.
This commit is contained in:
@@ -10,8 +10,8 @@ export interface SharePointFieldsState {
|
||||
/** Заголовки столбцов списка (site_url + list_name типа заявки) — источник значений для field_name шага. */
|
||||
export function useSharePointFields(
|
||||
client: SharePointListsClient | undefined,
|
||||
siteUrl: string | undefined | null,
|
||||
listTitle: string | undefined | null
|
||||
siteUrl: string | undefined,
|
||||
listTitle: string | undefined
|
||||
): SharePointFieldsState {
|
||||
const [items, setItems] = React.useState<SharePointListField[]>([]);
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
|
||||
@@ -2,22 +2,22 @@ import * as React from 'react';
|
||||
import { SharePointListsClient } from '../services/sharePointLists';
|
||||
|
||||
export interface SharePointListTitleState {
|
||||
title: string | null;
|
||||
title: string | undefined;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
/** Заголовок списка SharePoint по (site_url, list_id) — для отображения «Название (id)» вместо голого GUID. */
|
||||
export function useSharePointListTitle(
|
||||
client: SharePointListsClient | undefined,
|
||||
siteUrl: string | undefined | null,
|
||||
listId: string | undefined | null
|
||||
siteUrl: string | undefined,
|
||||
listId: string | undefined
|
||||
): SharePointListTitleState {
|
||||
const [title, setTitle] = React.useState<string | null>(null);
|
||||
const [title, setTitle] = React.useState<string | undefined>(undefined);
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!client || !siteUrl?.trim() || !listId?.trim()) {
|
||||
setTitle(null);
|
||||
setTitle(undefined);
|
||||
setIsLoading(false);
|
||||
return undefined;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export function useSharePointListTitle(
|
||||
|
||||
client.getListTitle(siteUrl.trim(), listId.trim())
|
||||
.then(result => { if (!cancelled) setTitle(result); })
|
||||
.catch(() => { if (!cancelled) setTitle(null); })
|
||||
.catch(() => { if (!cancelled) setTitle(undefined); })
|
||||
.finally(() => { if (!cancelled) setIsLoading(false); });
|
||||
|
||||
return () => { cancelled = true; };
|
||||
|
||||
@@ -2,21 +2,21 @@ import * as React from 'react';
|
||||
import { SharePointListsClient } from '../services/sharePointLists';
|
||||
|
||||
export interface SharePointSiteTitleState {
|
||||
title: string | null;
|
||||
title: string | undefined;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
/** Заголовок сайта SharePoint по его url — для отображения «Название — url» вместо голого url. */
|
||||
export function useSharePointSiteTitle(
|
||||
client: SharePointListsClient | undefined,
|
||||
siteUrl: string | undefined | null
|
||||
siteUrl: string | undefined
|
||||
): SharePointSiteTitleState {
|
||||
const [title, setTitle] = React.useState<string | null>(null);
|
||||
const [title, setTitle] = React.useState<string | undefined>(undefined);
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!client || !siteUrl?.trim()) {
|
||||
setTitle(null);
|
||||
setTitle(undefined);
|
||||
setIsLoading(false);
|
||||
return undefined;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export function useSharePointSiteTitle(
|
||||
|
||||
client.getSiteTitle(siteUrl.trim())
|
||||
.then(result => { if (!cancelled) setTitle(result); })
|
||||
.catch(() => { if (!cancelled) setTitle(null); })
|
||||
.catch(() => { if (!cancelled) setTitle(undefined); })
|
||||
.finally(() => { if (!cancelled) setIsLoading(false); });
|
||||
|
||||
return () => { cancelled = true; };
|
||||
|
||||
Reference in New Issue
Block a user