bfba296b91
CI / build (push) Successful in 35s
- PC 에디터: 🖼 → 압축 → 서버 업로드 → 본문에  삽입(base64 제거)
- Toast UI(웹/APK): addImageBlobHook 으로 동일하게 서버 업로드(base64 대체)
- 업로드 중/실패 안내 메시지 표시
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
import http from './http'
|
|
|
|
// 백엔드 /api/board 엔드포인트와 매핑
|
|
export const boardApi = {
|
|
list({ category = '', page = 1, size = 10, tag = '', keyword = '', searchType = '' } = {}) {
|
|
return http.get('/board/posts', {
|
|
params: {
|
|
category: category || undefined,
|
|
page,
|
|
size,
|
|
tag: tag || undefined,
|
|
keyword: keyword || undefined,
|
|
searchType: keyword ? searchType || 'title' : undefined,
|
|
},
|
|
})
|
|
},
|
|
get(id) {
|
|
return http.get(`/board/posts/${id}`)
|
|
},
|
|
create(payload) {
|
|
return http.post('/board/posts', payload)
|
|
},
|
|
update(id, payload) {
|
|
return http.put(`/board/posts/${id}`, payload)
|
|
},
|
|
remove(id) {
|
|
return http.delete(`/board/posts/${id}`)
|
|
},
|
|
// 본문 인라인 이미지 업로드(서버 DB 저장) → { url } (예: /api/images/123)
|
|
uploadImage(blob) {
|
|
const fd = new FormData()
|
|
fd.append('image', blob, 'image.jpg')
|
|
return http.post('/board/images', fd, {
|
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
timeout: 30000,
|
|
})
|
|
},
|
|
tags() {
|
|
return http.get('/board/tags')
|
|
},
|
|
tagGroups() {
|
|
return http.get('/board/tag-groups')
|
|
},
|
|
addComment(id, content) {
|
|
return http.post(`/board/posts/${id}/comments`, { content })
|
|
},
|
|
removeComment(commentId) {
|
|
return http.delete(`/board/comments/${commentId}`)
|
|
},
|
|
block(id, reason) {
|
|
return http.post(`/board/posts/${id}/block`, { reason })
|
|
},
|
|
unblock(id) {
|
|
return http.post(`/board/posts/${id}/unblock`)
|
|
},
|
|
}
|