refactor(api): 统一将/story/路径修改为/api/story/
All checks were successful
test/timeline-frontend/pipeline/head This commit looks good
All checks were successful
test/timeline-frontend/pipeline/head This commit looks good
修改服务端API路径前缀以保持一致性,涉及前端请求、nginx配置和代理设置
This commit is contained in:
@@ -15,13 +15,13 @@ export default {
|
|||||||
// 如果需要自定义本地开发服务器 请取消注释按需调整
|
// 如果需要自定义本地开发服务器 请取消注释按需调整
|
||||||
dev: {
|
dev: {
|
||||||
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
||||||
'/story/': {
|
'/api/story/': {
|
||||||
// 要代理的地址
|
// 要代理的地址
|
||||||
target: basePath,
|
target: basePath,
|
||||||
// 配置了这个可以从 http 代理到 https
|
// 配置了这个可以从 http 代理到 https
|
||||||
// 依赖 origin 的功能可能需要这个,比如 cookie
|
// 依赖 origin 的功能可能需要这个,比如 cookie
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: { '^/story': '/story' },
|
pathRewrite: { '^/api/story': '/api/story' },
|
||||||
},
|
},
|
||||||
'/file/': {
|
'/file/': {
|
||||||
// 要代理的地址
|
// 要代理的地址
|
||||||
@@ -57,13 +57,13 @@ export default {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: { '^': '' },
|
pathRewrite: { '^': '' },
|
||||||
},
|
},
|
||||||
'/story/': {
|
'/api/story/': {
|
||||||
// 要代理的地址
|
// 要代理的地址
|
||||||
target: 'http://localhost:30001',
|
target: 'http://localhost:30001',
|
||||||
// 配置了这个可以从 http 代理到 https
|
// 配置了这个可以从 http 代理到 https
|
||||||
// 依赖 origin 的功能可能需要这个,比如 cookie
|
// 依赖 origin 的功能可能需要这个,比如 cookie
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: { '^/story': '/story' },
|
pathRewrite: { '^/api/story': '/api/story' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pre: {
|
pre: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ http {
|
|||||||
proxy_set_header Authorization $http_authorization;
|
proxy_set_header Authorization $http_authorization;
|
||||||
proxy_pass http://localhost:33333/file/;
|
proxy_pass http://localhost:33333/file/;
|
||||||
}
|
}
|
||||||
location /story/ {
|
location /api/story/ {
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
@@ -38,7 +38,7 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Host $host;
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
proxy_set_header Authorization $http_authorization;
|
proxy_set_header Authorization $http_authorization;
|
||||||
proxy_pass http://localhost:33333/story/;
|
proxy_pass http://localhost:33333/api/story/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# MinIO 对象存储代理
|
# MinIO 对象存储代理
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ self.addEventListener('fetch', (event) => {
|
|||||||
*/
|
*/
|
||||||
function isApiRequest(url) {
|
function isApiRequest(url) {
|
||||||
return url.pathname.startsWith('/api/') ||
|
return url.pathname.startsWith('/api/') ||
|
||||||
url.pathname.startsWith('/story/') ||
|
url.pathname.startsWith('/api/story/') ||
|
||||||
url.pathname.startsWith('/file/') ||
|
url.pathname.startsWith('/file/') ||
|
||||||
url.pathname.startsWith('/user/');
|
url.pathname.startsWith('/user/');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export async function queryHistoryMessages(): Promise<CommonResponse<HistoryMess
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function queryFriendDynamic(): Promise<CommonResponse<HistoryMessage[]>> {
|
export async function queryFriendDynamic(): Promise<CommonResponse<HistoryMessage[]>> {
|
||||||
return request('/story/activity/authorized-items', {
|
return request('/api/story/activity/authorized-items', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ type ParamsType = {
|
|||||||
export async function queryTimelineList(
|
export async function queryTimelineList(
|
||||||
params: ParamsType,
|
params: ParamsType,
|
||||||
): Promise<{ data: StoryType[] }> {
|
): Promise<{ data: StoryType[] }> {
|
||||||
return await request('/story/list', {
|
return await request('/api/story/list', {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
export async function deleteStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
||||||
return request(`/story/${params.instanceId}`, {
|
return request(`/api/story/${params.instanceId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
export async function addStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
||||||
return request('/story/add', {
|
return request('/api/story/add', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
...params,
|
...params,
|
||||||
@@ -35,7 +35,7 @@ export async function addStory(params: ParamsType): Promise<{ data: { list: Stor
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function updateStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
export async function updateStory(params: ParamsType): Promise<{ data: { list: StoryType[] } }> {
|
||||||
return await request(`/story/${params.instanceId}`, {
|
return await request(`/api/story/${params.instanceId}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: {
|
data: {
|
||||||
...params,
|
...params,
|
||||||
@@ -44,12 +44,12 @@ export async function updateStory(params: ParamsType): Promise<{ data: { list: S
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function queryStoryDetail(itemId: string): Promise<{ data: StoryType }> {
|
export async function queryStoryDetail(itemId: string): Promise<{ data: StoryType }> {
|
||||||
return request(`/story/${itemId}`, {
|
return request(`/api/story/${itemId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function addStoryItem(params: FormData): Promise<any> {
|
export async function addStoryItem(params: FormData): Promise<any> {
|
||||||
return request(`/story/item`, {
|
return request(`/api/story/item`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: params,
|
data: params,
|
||||||
requestType: 'form',
|
requestType: 'form',
|
||||||
@@ -57,7 +57,7 @@ export async function addStoryItem(params: FormData): Promise<any> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function updateStoryItem(params: FormData): Promise<any> {
|
export async function updateStoryItem(params: FormData): Promise<any> {
|
||||||
return request(`/story/item`, {
|
return request(`/api/story/item`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: params,
|
data: params,
|
||||||
requestType: 'form',
|
requestType: 'form',
|
||||||
@@ -66,29 +66,29 @@ export async function updateStoryItem(params: FormData): Promise<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function queryStoryItem(params: ParamsType): Promise<{ data: CommonListResponse<StoryItem> }> {
|
export async function queryStoryItem(params: ParamsType): Promise<{ data: CommonListResponse<StoryItem> }> {
|
||||||
return request(`/story/item/list`, {
|
return request(`/api/story/item/list`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: params,
|
params: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function queryStoryItemDetail(itemId: string): Promise<{ data: StoryItem }> {
|
export async function queryStoryItemDetail(itemId: string): Promise<{ data: StoryItem }> {
|
||||||
return request(`/story/item/${itemId}`, {
|
return request(`/api/story/item/${itemId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function countStoryItem(storyInstanceId: string): Promise<{ data: StoryItem }> {
|
export async function countStoryItem(storyInstanceId: string): Promise<{ data: StoryItem }> {
|
||||||
return request(`/story/item/count/${storyInstanceId}`, {
|
return request(`/api/story/item/count/${storyInstanceId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function queryStoryItemImages(itemId: string): Promise<{ data: string[] }> {
|
export async function queryStoryItemImages(itemId: string): Promise<{ data: string[] }> {
|
||||||
return request(`/story/item/images/${itemId}`, {
|
return request(`/api/story/item/images/${itemId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function removeStoryItem(instanceId: string) {
|
export async function removeStoryItem(instanceId: string): Promise<CommonResponse<void>> {
|
||||||
return request(`/api/story/item/${instanceId}`, {
|
return request(`/api/story/item/${instanceId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
@@ -110,46 +110,46 @@ export async function fetchImage(imageInstanceId: string): Promise<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function authorizeStoryPermission(params: {userId: string, storyInstanceId: string, permissionType: number}) {
|
export async function authorizeStoryPermission(params: {userId: string, storyInstanceId: string, permissionType: number}) {
|
||||||
return request('/story/permission/authorize', {
|
return request('/api/story/permission/authorize', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: params,
|
data: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStoryPermissions(storyId: string) {
|
export async function getStoryPermissions(storyId: string) {
|
||||||
return request(`/story/permission/story/${storyId}`, {
|
return request(`/api/story/permission/story/${storyId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function inviteUser(params: {userId: string, storyInstanceId: string, permissionType: number}) {
|
export async function inviteUser(params: {userId: string, storyInstanceId: string, permissionType: number}) {
|
||||||
return request('/story/permission/invite', {
|
return request('/api/story/permission/invite', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: params,
|
data: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function acceptInvite(inviteId: string) {
|
export async function acceptInvite(inviteId: string) {
|
||||||
return request(`/story/permission/invite/${inviteId}/accept`, {
|
return request(`/api/story/permission/invite/${inviteId}/accept`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function rejectInvite(inviteId: string) {
|
export async function rejectInvite(inviteId: string) {
|
||||||
return request(`/story/permission/invite/${inviteId}/reject`, {
|
return request(`/api/story/permission/invite/${inviteId}/reject`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updatePermission(params: {permissionId: string, permissionType: number}) {
|
export async function updatePermission(params: {permissionId: string, permissionType: number}) {
|
||||||
return request('/story/permission', {
|
return request('/api/story/permission', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: params
|
data: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function removePermission(permissionId: string) {
|
export async function removePermission(permissionId: string) {
|
||||||
return request(`/story/permission/${permissionId}`, {
|
return request(`/api/story/permission/${permissionId}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ export async function removePermission(permissionId: string) {
|
|||||||
export async function updateStoryItemOrder(
|
export async function updateStoryItemOrder(
|
||||||
orderData: Array<{ instanceId: string; sortOrder: number }>
|
orderData: Array<{ instanceId: string; sortOrder: number }>
|
||||||
): Promise<CommonResponse<void>> {
|
): Promise<CommonResponse<void>> {
|
||||||
return request('/story/item/order', {
|
return request('/api/story/item/order', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: { items: orderData },
|
data: { items: orderData },
|
||||||
});
|
});
|
||||||
@@ -195,7 +195,7 @@ export async function updateStoryItemOrder(
|
|||||||
export async function batchDeleteStoryItems(
|
export async function batchDeleteStoryItems(
|
||||||
instanceIds: string[]
|
instanceIds: string[]
|
||||||
): Promise<CommonResponse<void>> {
|
): Promise<CommonResponse<void>> {
|
||||||
return request('/story/item/batch-delete', {
|
return request('/api/story/item/batch-delete', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { instanceIds },
|
data: { instanceIds },
|
||||||
});
|
});
|
||||||
@@ -215,7 +215,7 @@ export async function batchUpdateStoryItemTime(
|
|||||||
instanceIds: string[],
|
instanceIds: string[],
|
||||||
storyItemTime: string
|
storyItemTime: string
|
||||||
): Promise<CommonResponse<void>> {
|
): Promise<CommonResponse<void>> {
|
||||||
return request('/story/item/batch-time', {
|
return request('/api/story/item/batch-time', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: { instanceIds, storyItemTime },
|
data: { instanceIds, storyItemTime },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {CommonListResponse, CommonResponse} from "@/types/common";
|
|||||||
import {ImageItem} from "@/pages/gallery/typings";
|
import {ImageItem} from "@/pages/gallery/typings";
|
||||||
// 查询storyItem图片列表
|
// 查询storyItem图片列表
|
||||||
export async function queryStoryItemImages(itemId: string): Promise<{ data: string[] }> {
|
export async function queryStoryItemImages(itemId: string): Promise<{ data: string[] }> {
|
||||||
return request(`/story/item/images/${itemId}`, {
|
return request(`/api/story/item/images/${itemId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user