echo-dimigo/echo-front

View on GitHub
src/api/comment/user.js

Summary

Maintainability
A
40 mins
Test Coverage
import axios from 'axios'
import { Comment, CreateComment } from '@/api/struct'
 
export default {
async addComment (comment) {
comment = CreateComment(comment)
await axios.post('/echo/comment', comment)
},
 
async deleteComment (idx) {
await axios.delete(`/echo/comment/${idx}`)
},
 
async editComment (idx, comment) {
comment = CreateComment(comment)
await axios.put(`/echo/comment/${idx}`, comment)
},
 
Similar blocks of code found in 3 locations. Consider refactoring.
async getCommentNotice () {
const { data: { comments } } =
await axios.get('/echo/comment/notices')
return comments.map(Comment)
}
}