mirror of https://github.com/fantasticit/think.git
client: update api reference
This commit is contained in:
parent
fd2d5e7052
commit
4891c278db
|
@ -7,18 +7,21 @@ import { Empty } from 'components/empty';
|
|||
import { IconSearch } from 'components/icons';
|
||||
import { IconDocumentFill } from 'components/icons/IconDocumentFill';
|
||||
import { LocaleTime } from 'components/locale-time';
|
||||
import { useRecentDocuments } from 'data/document';
|
||||
import { useAsyncLoading } from 'hooks/use-async-loading';
|
||||
import { useToggle } from 'hooks/use-toggle';
|
||||
import Link from 'next/link';
|
||||
import Router from 'next/router';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { searchDocument } from 'services/document';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { HttpClient } from 'services/http-client';
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const searchDocument = (keyword: string): Promise<IDocument[]> => {
|
||||
return HttpClient.get('/document/search', { params: { keyword } });
|
||||
};
|
||||
|
||||
const List: React.FC<{ data: IDocument[] }> = ({ data }) => {
|
||||
return (
|
||||
<div className={styles.itemsWrap}>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { DocumentApiDefinition, IDocument } from '@think/domains';
|
||||
import { DocumentPublicReader } from 'components/document/reader/public';
|
||||
import { getPublicDocumentDetail } from 'data/document';
|
||||
import { NextPage } from 'next';
|
||||
import React from 'react';
|
||||
import { getPublicDocumentDetail } from 'services/document';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
interface IProps {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { DocumentApiDefinition, IDocument, IWiki, WikiApiDefinition } from '@think/domains';
|
||||
import { DocumentPublicReader } from 'components/document/reader/public';
|
||||
import { WikiPublicTocs } from 'components/wiki/tocs/public';
|
||||
import { getPublicDocumentDetail } from 'data/document';
|
||||
import { getPublicWikiTocs } from 'data/wiki';
|
||||
import { PublicDoubleColumnLayout } from 'layouts/public-double-column';
|
||||
import { NextPage } from 'next';
|
||||
import React from 'react';
|
||||
import { getPublicDocumentDetail } from 'services/document';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
interface IProps {
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import { IDocument, IUser, IWiki } from '@think/domains';
|
||||
|
||||
import { HttpClient } from './http-client';
|
||||
|
||||
/**
|
||||
* 更新文档阅读量
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
export const updateDocumentViews = (id: string) => {
|
||||
return HttpClient.get('/document/views/' + id);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取公开文档详情
|
||||
* @param id
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export const getPublicDocumentDetail = (
|
||||
id: string,
|
||||
data: Partial<Pick<IDocument, 'sharePassword'>>
|
||||
): Promise<IDocument & { createUse: IUser; wiki: IWiki }> => {
|
||||
return HttpClient.post('/document/public/detail/' + id, data);
|
||||
};
|
||||
|
||||
/**
|
||||
* 搜索文档
|
||||
* @param keyword
|
||||
* @returns
|
||||
*/
|
||||
export const searchDocument = (keyword: string): Promise<IDocument[]> => {
|
||||
return HttpClient.get('/document/search', { params: { keyword } });
|
||||
};
|
Loading…
Reference in New Issue