27 lines
874 B
JavaScript
27 lines
874 B
JavaScript
import Vue from 'vue';
|
|
import { buildGiftCategoryRequest } from '@/utils/gift_category'
|
|
|
|
const baseUrl = '/api/v2/admin/gift-categories'
|
|
|
|
async function getGiftCategories() {
|
|
const response = await Vue.axios.get(baseUrl)
|
|
return response.data
|
|
}
|
|
|
|
async function createGiftCategory(form) {
|
|
const response = await Vue.axios.post(baseUrl, buildGiftCategoryRequest(form))
|
|
return response.data
|
|
}
|
|
|
|
async function updateGiftCategory(categoryId, form) {
|
|
const response = await Vue.axios.put(`${baseUrl}/${encodeURIComponent(categoryId)}`, buildGiftCategoryRequest(form))
|
|
return response.data
|
|
}
|
|
|
|
async function deactivateGiftCategory(categoryId) {
|
|
const response = await Vue.axios.delete(`${baseUrl}/${encodeURIComponent(categoryId)}`)
|
|
return response.data
|
|
}
|
|
|
|
export { getGiftCategories, createGiftCategory, updateGiftCategory, deactivateGiftCategory }
|