don't repeat API_URL

wechat_user_type
Ge Hao 8 years ago
parent 8cd156ac26
commit cde539f10f
  1. 3
      app.js
  2. 4
      utils/address.js
  3. 4
      utils/order.js
  4. 8
      utils/product.js
  5. 7
      utils/profile.js

@ -30,6 +30,7 @@ App({
globalData:{
userInfo: null,
currentCustomer: null
currentCustomer: null,
API_URL: 'https://rapi-staging.bayekeji.com'
}
})

@ -1,9 +1,9 @@
const API_URL = 'https://rapi.bayekeji.com'
const app = getApp()
function postAddress (data) {
wx.request({
method: 'POST',
url: `${API_URL}/addresses/new`,
url: `${app.globalData.API_URL}/addresses/new`,
data: Object.assign({}, data),
header: { 'Content-Type': 'application/json' },
success (res) {

@ -1,9 +1,9 @@
const API_URL = 'https://rapi.bayekeji.com'
const app = getApp()
function postBilling (data, resolve) {
wx.request({
method: 'POST',
url: `${API_URL}/orders`,
url: `${app.globalData.API_URL}/orders`,
data: data,
header: { 'Content-Type': 'application/json'},
success: resolve,

@ -1,8 +1,8 @@
const API_URL = 'https://rapi.bayekeji.com'
const app = getApp()
function getProducts (resolve) {
wx.request({
url: `${API_URL}/products`,
url: `${app.globalData.API_URL}/products`,
header: { 'Content-Type': 'application/json' },
success: resolve,
fail: function(){}
@ -11,7 +11,7 @@ function getProducts (resolve) {
function getSlides (resolve) {
wx.request({
url: `${API_URL}/home_slides`,
url: `${app.globalData.API_URL}/home_slides`,
header: { 'Content-Type': 'application/json' },
success: resolve,
fail: function(){}
@ -20,7 +20,7 @@ function getSlides (resolve) {
function getCategories (data, resolve, reject) {
wx.request({
url: `${API_URL}/products?type=${data}`,
url: `${app.globalData.API_URL}/products?type=${data}`,
header: { 'Content-Type': 'application/json'},
success: resolve,
fail: reject

@ -1,9 +1,8 @@
const API_URL = 'https://rapi.bayekeji.com'
const app = getApp()
function getZichanSlides (resolve) {
wx.request({
url: `${API_URL}/profiles/zichan_sildes`,
url: `${app.globalData.API_URL}/profiles/zichan_sildes`,
data: {token: app.globalData.token},
header: { 'Content-Type': 'application/json'},
success: resolve,
@ -13,7 +12,7 @@ function getZichanSlides (resolve) {
function getCustomerInfo (customerMobile, cb) {
wx.request({
url: `${API_URL}/sessions/new`,
url: `${app.globalData.API_URL}/sessions/new`,
header: { 'Content-Type': 'application/json'},
data: {
code: app.globalData.code,
@ -32,7 +31,7 @@ function getCustomerInfo (customerMobile, cb) {
function getPassCode (mobile) {
wx.request({
url: `${API_URL}/profile/send_pass_code`,
url: `${app.globalData.API_URL}/profile/send_pass_code`,
header: { 'Content-Type': 'application/json'},
data: {
mobile: mobile

Loading…
Cancel
Save