echo-dimigo/echo-front

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

Summary

Maintainability
A
1 hr
Test Coverage
import axios from 'axios'
import { Tag } from '@/api/struct'
 
export default {
Similar blocks of code found in 3 locations. Consider refactoring.
async getAllTag () {
const { data: { tags } } = await axios.get('/echo/tags')
return tags.map(Tag)
},
 
Similar blocks of code found in 2 locations. Consider refactoring.
async getTagByIdx (idx) {
const { data: tag } = await axios.get(`/echo/tag/${idx}`)
return Tag(tag)
},
 
async deleteTag (idx) {
await axios.delete(`/echo/tag/${idx}`)
},
 
Similar blocks of code found in 3 locations. Consider refactoring.
async getAllInvitations () {
const { data: { tags } } =
await axios.get('/echo/user_tag/my/invitations')
return tags.map(Tag)
},
 
async getSubscriptionRequests () {
const { data: { tags } } =
axios.get(`/echo/user_tag/my/requests`)
return tags.map(Tag)
},
 
async requestSubscription (idx) {
await axios.post(`/echo/user_tag/my/request/${idx}`)
},
 
async cancelSubscriptionRequest (idx) {
await axios.delete(`/echo/user_tag/my/${idx}`)
}
}