mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 19:16:24 +00:00
feat: 更新评论和帖子模型,添加用户信息和原创标识,优化API请求和组件结构
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import axios from 'axios'
|
||||
import { camelToSnakeObj, snakeToCamelObj } from 'field-conv'
|
||||
|
||||
export const BACKEND_URL = process.env.BACKEND_URL || 'http://neo-blog-backend:8888'
|
||||
export const BACKEND_URL = process.env.BACKEND_URL || (process.env.NODE_ENV == "production" ? 'http://neo-blog-backend:8888' : 'http://localhost:8888')
|
||||
|
||||
console.info(`Using backend URL: ${BACKEND_URL}`)
|
||||
console.info(`Using ${process.env.NODE_ENV} backend URL: ${BACKEND_URL}`)
|
||||
|
||||
const isServer = typeof window === 'undefined'
|
||||
|
||||
|
@ -11,9 +11,8 @@ interface ListPostsParams {
|
||||
}
|
||||
|
||||
export async function getPostById(id: string): Promise<Post | null> {
|
||||
console.log('Fetching post by ID:', id)
|
||||
try {
|
||||
const res = await axiosClient.get<BaseResponse<Post>>(`/post/p/19`)
|
||||
const res = await axiosClient.get<BaseResponse<Post>>(`/post/p/${id}`)
|
||||
return res.data.data
|
||||
}
|
||||
catch (error) {
|
||||
|
Reference in New Issue
Block a user