You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
const API_URL = 'http://localhost:3000' |
|
|
|
function getProducts (data) { |
|
data = data ? `/${data}` : '' |
|
return new Promise((resolve, reject) => { |
|
wx.request({ |
|
url: `${API_URL}/products${data}`, |
|
header: { 'Content-Type': 'application/json' }, |
|
success: resolve, |
|
fail: reject |
|
}) |
|
}) |
|
} |
|
|
|
function getSlides () { |
|
return new Promise((resolve, reject) => { |
|
wx.request({ |
|
url: `${API_URL}/home_slides`, |
|
header: { 'Content-Type': 'application/json' }, |
|
success: resolve, |
|
fail: reject |
|
}) |
|
}) |
|
} |
|
|
|
function postBilling (data) { |
|
return new Promise((resolve, reject) => { |
|
wx.request({ |
|
method: 'POST', |
|
url: `${API_URL}/carts/billings`, |
|
data: data, |
|
header: { 'Content-Type': 'application/json'}, |
|
success: resolve, |
|
fail: reject |
|
}) |
|
}) |
|
} |
|
|
|
|
|
module.exports = { |
|
getProducts () { |
|
return getProducts() |
|
}, |
|
getProduct (data) { |
|
return getProducts(data) |
|
}, |
|
|
|
getSlides () { |
|
return getSlides() |
|
}, |
|
|
|
postBilling (data) { |
|
return postBilling(data) |
|
} |
|
}
|
|
|