client: update api reference

This commit is contained in:
fantasticit 2022-06-03 16:48:43 +08:00
parent fd2d5e7052
commit 4891c278db
4 changed files with 8 additions and 39 deletions

View File

@ -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}>

View File

@ -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 {

View File

@ -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 {

View File

@ -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 } });
};