echo-dimigo/echo-front

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

Summary

Maintainability
A
40 mins
Test Coverage
import axios from 'axios'
import { Post, CreatePost } from '@/api/struct'
 
export default {
async getBriefPosts () {
const { data: { posts } } = await axios.get('/echo/posts/brief')
return posts
},
 
Similar blocks of code found in 2 locations. Consider refactoring.
async getPostById (idx) {
const { data: post } = await axios.get(`/echo/post/${idx}`)
return Post(post)
},
 
async addPost (post) {
post = CreatePost(post)
await axios.post('/echo/post', post)
}
}