add new method refactor
This commit is contained in:
parent
57a4820de2
commit
92742b3942
2 changed files with 21 additions and 8 deletions
|
|
@ -1,6 +1,16 @@
|
|||
import { apiClient } from '@/services/apiClient.js'
|
||||
import router from '@/router/index.js'
|
||||
|
||||
export const useMerchApi = () => {
|
||||
const addMerch = async (payload) => {
|
||||
const response = await apiClient.post('/merch/', payload.value)
|
||||
if (response.status === 200) {
|
||||
router.push({ name: 'collection' })
|
||||
} else {
|
||||
console.log("Add merch error: ", response)
|
||||
}
|
||||
}
|
||||
|
||||
const deleteMerch = async (uuid) => {
|
||||
try {
|
||||
const response = await apiClient.delete(`/merch/${uuid}`)
|
||||
|
|
@ -11,6 +21,7 @@ export const useMerchApi = () => {
|
|||
}
|
||||
|
||||
return {
|
||||
addMerch,
|
||||
deleteMerch,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue