generated from tailored/router-db-template
51 lines
1013 B
TypeScript
51 lines
1013 B
TypeScript
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,
|
|
};
|
|
};
|