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:{ globalData:{
userInfo: null, 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) { function postAddress (data) {
wx.request({ wx.request({
method: 'POST', method: 'POST',
url: `${API_URL}/addresses/new`, url: `${app.globalData.API_URL}/addresses/new`,
data: Object.assign({}, data), data: Object.assign({}, data),
header: { 'Content-Type': 'application/json' }, header: { 'Content-Type': 'application/json' },
success (res) { success (res) {

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

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

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

Loading…
Cancel
Save