1(() => { 2/** @type {typeof window.API} */ 3const API = window.API = {}; 4const APIRequest = window.$API.APIRequest; 5const Root = new APIRequest('/', { 6 timeout: 30000, 7 maximum: 5, 8}); 9function isv2(headers) { 10 if (!headers) { 11 return false; 12 } 13 if (headers['response-version'] === '2.0') { 14 return true; 15 } 16 return false; 17} 18Root.request.use(val => { 19 if (window.D_AREA && val.url) { 20 val.url = window.D_AREA + val.url; 21 } 22 if (!val.headers) { 23 val.headers = {}; 24 } 25 val.headers['X-Requested-With'] = 'XMLHttpRequest'; 26 val.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; 27 return val; 28}); 29Root.response.use(val => { 30 if (isv2(val.headers)) { 31 return Promise.resolve(val.data?.data); 32 } 33 return Promise.resolve(val.data); 34}, err => { 35 const response = err.response; 36 return Promise.reject(response?.data); 37}); 38 39API.getPhoneAuthCode = (data) => { 40 return Root.post('/authUser/getPhoneAuthCode', data, { 41 singleType: APIRequest.Single.PREV, 42 }); 43}; 44API.verifySMSCode = (phone, code) => { 45 return Root.post('/authUser/verifySMSCode', { phone, code }, { 46 singleType: APIRequest.Single.PREV, 47 }); 48}; 49API.validatePhone = (phone) => { 50 return Root.post('/authUser/validatePhone', { phone, }, { 51 singleType: APIRequest.Single.NEXT, 52 }); 53}; 54API.recordLoginPrefillAccount = (prefill_account = '') => { 55 return Root.post('/authUser/signinPrefill', { prefill_account: prefill_account || '' }); 56}; 57API.recordAutoLogin = (is_cookie = true) => { 58 if (typeof is_cookie !== 'boolean') { 59 is_cookie = true; 60 } 61 return Root.post('/authUser/autoLoginRecord', { is_cookie: is_cookie }); 62}; 63API.switchDomain = (oldDomain, newDomain = '') => { 64 return Root.post('/authUser/switchDomain', { old_domain: oldDomain, new_domain: newDomain }); 65}; 66API.setPayPassword = (password) => { 67 return Root.post('/user/payPassword', { password: password }); 68}; 69API.beforePay = (channel, order_number, pwd = '') => { 70 return Root.post('/cart/beforePay', { channel: channel, order_number: order_number, pay_password: pwd }); 71}; 72API.lekaPay = (channel, order_number) => { 73 return Root.post('/cart/lekaPay', { channel: channel, order_number: order_number }, { timeout: 60000 }); 74}; 75 76API.getEmailAuthCode = (email, type) => { 77 return Root.post('/user/getEmailAuthCode', { email: email , type: type}); 78}; 79 80API.verifyEmailCode = (email, type, code) => { 81 return Root.post('/user/verifyEmail', {email, type, code}, { 82 singleType: APIRequest.Single.PREV, 83 }); 84}; 85 86})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.