init
This commit is contained in:
90
src/pages/list/basic-list/service.ts
Normal file
90
src/pages/list/basic-list/service.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { request } from '@umijs/max';
|
||||
import {AddStoryItem, BaseResponse, StoryItem, StoryType} from './data.d';
|
||||
|
||||
type ParamsType = {
|
||||
count?: number;
|
||||
instanceId?: string;
|
||||
} & Partial<StoryType>;
|
||||
|
||||
export async function queryTimelineList(
|
||||
params: ParamsType,
|
||||
): Promise<{ data: { data: StoryType[] } }> {
|
||||
return await request('/story/owner/test11', {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteStory(
|
||||
params: ParamsType,
|
||||
): Promise<{ data: { list: StoryType[] } }> {
|
||||
return request(`/story/${params.instanceId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function addStory(
|
||||
params: ParamsType,
|
||||
): Promise<{ data: { list: StoryType[] } }> {
|
||||
return request('/story/add', {
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params,
|
||||
method: 'post',
|
||||
},
|
||||
});
|
||||
}
|
||||
export async function updateStory(
|
||||
params: ParamsType,
|
||||
): Promise<{ data: { list: StoryType[] } }> {
|
||||
return await request(`/story/${params.instanceId}`, {
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params,
|
||||
method: 'put',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function addStoryItem(
|
||||
params: FormData,
|
||||
): Promise<any> {
|
||||
return request(`/story/item`, {
|
||||
method: 'POST',
|
||||
data: params,
|
||||
requestType: 'form',
|
||||
getResponse: true,
|
||||
});
|
||||
}
|
||||
export async function queryStoryItem(
|
||||
masterItemId: string,
|
||||
): Promise<{ data: StoryItem[] }> {
|
||||
return request(`/story/item/list`, {
|
||||
method: 'GET',
|
||||
params: {
|
||||
masterItemId,
|
||||
},
|
||||
});
|
||||
}
|
||||
export async function queryStoryItemDetail(
|
||||
itemId: string,
|
||||
): Promise<{ data: StoryItem[] }> {
|
||||
return request(`/story/item/${itemId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
export async function queryStoryItemImages(
|
||||
itemId: string,
|
||||
): Promise<{ data: string[] }> {
|
||||
return request(`/story/item/images/${itemId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
export async function fetchImage(
|
||||
imageInstanceId: string,
|
||||
): Promise<any> {
|
||||
return request(`/file/download/cover/${imageInstanceId}`, {
|
||||
method: 'GET',
|
||||
responseType: 'blob',
|
||||
getResponse: true,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user