mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
42 lines
871 B
JavaScript
42 lines
871 B
JavaScript
import { API_Call, gen_endpoint } from 'app'
|
|
|
|
export const comty_post_comment = {
|
|
delete: (callback, payload) => {
|
|
if (!payload) {
|
|
return false
|
|
}
|
|
const { comment_id } = payload
|
|
|
|
let formdata = new FormData()
|
|
formdata.append('type', 'delete')
|
|
formdata.append('comment_id', comment_id)
|
|
|
|
API_Call(
|
|
(err, res) => {
|
|
return callback(err, res)
|
|
},
|
|
gen_endpoint("comments"),
|
|
formdata
|
|
)
|
|
},
|
|
new: (callback, payload) => {
|
|
if (!payload) {
|
|
return false
|
|
}
|
|
const { post_id, raw_text } = payload
|
|
|
|
let formdata = new FormData()
|
|
formdata.append('action', 'comment')
|
|
formdata.append('post_id', post_id)
|
|
formdata.append('text', raw_text)
|
|
|
|
API_Call(
|
|
(err, res) => {
|
|
return callback(err, res)
|
|
},
|
|
gen_endpoint("post-actions"),
|
|
formdata
|
|
)
|
|
},
|
|
}
|