create coupon section

This commit is contained in:
HAM!DREZA
2024-06-27 18:58:38 +03:30
parent 77e89513e6
commit a3c5108151
12 changed files with 305 additions and 205 deletions
+16
View File
@@ -18,6 +18,12 @@ export const useDiscountStore = defineStore('discounts', {
return this.items = data
},
async add(form) {
this.fetching = true
const { status, data } = await axios.post('/admins/discount', form)
this.fetching = false
return data
},
async getDiscount(id) {
this.items = [];
this.fetching = true
@@ -26,6 +32,16 @@ export const useDiscountStore = defineStore('discounts', {
return this.items = data
},
async update(form) {
const { status, data } = await axios.put('/admins/discount', form)
this.fetching = false
return data
},
async changeStatus(form) {
const { status, data } = await axios.patch('/admins/discount/status', form)
this.fetching = false
return data
}
// async create(newCourse) {
// const { status, data } = await axios.post('/course', newCourse)