40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
import Vue from 'vue';
|
|
|
|
const baseUrl = '/api/v2/admin/gifts'
|
|
|
|
async function getGifts({ status, applicationNo, nickname, page = 0, size = 20 } = {}) {
|
|
const params = { page, size }
|
|
if (status) params.status = status
|
|
if (applicationNo) params.applicationNo = applicationNo
|
|
if (nickname) params.nickname = nickname
|
|
const response = await Vue.axios.get(baseUrl, { params })
|
|
return response.data
|
|
}
|
|
|
|
async function getGift(applicationNo) {
|
|
const response = await Vue.axios.get(`${baseUrl}/${encodeURIComponent(applicationNo)}`)
|
|
return response.data
|
|
}
|
|
|
|
async function arriveMailbox(applicationNo) {
|
|
const response = await Vue.axios.post(`${baseUrl}/${encodeURIComponent(applicationNo)}/arrive-mailbox`)
|
|
return response.data
|
|
}
|
|
|
|
async function completeInspection(applicationNo) {
|
|
const response = await Vue.axios.post(`${baseUrl}/${encodeURIComponent(applicationNo)}/complete-inspection`)
|
|
return response.data
|
|
}
|
|
|
|
async function completeDelivery(applicationNo) {
|
|
const response = await Vue.axios.post(`${baseUrl}/${encodeURIComponent(applicationNo)}/complete-delivery`)
|
|
return response.data
|
|
}
|
|
|
|
async function markUndeliverable(applicationNo, reason) {
|
|
const response = await Vue.axios.post(`${baseUrl}/${encodeURIComponent(applicationNo)}/mark-undeliverable`, { reason })
|
|
return response.data
|
|
}
|
|
|
|
export { getGifts, getGift, arriveMailbox, completeInspection, completeDelivery, markUndeliverable }
|