generated from tailored/router-db-template
add db module
This commit is contained in:
50
packages/xhs/src/libs/xhs-api/api.ts
Normal file
50
packages/xhs/src/libs/xhs-api/api.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
type ApiInfo = {
|
||||
uri: string;
|
||||
method?: 'GET' | 'POST';
|
||||
needSign?: boolean;
|
||||
description?: string;
|
||||
isCreator?: boolean;
|
||||
};
|
||||
export const api: ApiInfo[] = [
|
||||
{
|
||||
uri: '/api/sns/web/v1/you/mentions',
|
||||
method: 'GET',
|
||||
description: '获取@我的消息',
|
||||
},
|
||||
{
|
||||
uri: '/api/sns/web/v1/you/likes',
|
||||
method: 'GET',
|
||||
description: '获取点赞的消息',
|
||||
},
|
||||
{
|
||||
uri: '/api/sns/web/v1/you/connections',
|
||||
method: 'GET',
|
||||
description: '获取关注的消息',
|
||||
needSign: true,
|
||||
},
|
||||
{
|
||||
uri: '/api/sns/web/v1/you/mentions',
|
||||
method: 'GET',
|
||||
needSign: true,
|
||||
description: '获取@我的消息',
|
||||
},
|
||||
];
|
||||
|
||||
type ReturnApiInfo = {
|
||||
apiInfo: ApiInfo;
|
||||
needSign: boolean;
|
||||
};
|
||||
export const getApiInfo = (uri: string): ReturnApiInfo | null => {
|
||||
const apiInfo = api.find((item) => item.uri?.startsWith(uri));
|
||||
if (apiInfo) {
|
||||
return {
|
||||
apiInfo,
|
||||
needSign: apiInfo.needSign ?? true,
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
apiInfo: null,
|
||||
needSign: true,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user