Best JavaScript code snippet using appium-base-driver
main.js
Source:main.js
1import axios from 'axios';2import qs from 'qs';3axios.defaults.validateStatus=(status)=>{4 if (status === 401) {//没ç»é5 localStorage.removeItem('role');6 localStorage.removeItem('zlfuserInfo');7 window.location.href='/home.html';8 return false;9 } else {10 return true11 };12}13var TIME_OUT=50000;14var zlf_base_prefix15if(__DEV__){16 zlf_base_prefix = 1?'https://api.zulifangs.com':'http://redliam.51vip.biz:20095/api-zlf';//'http://hjj1.tunnel.echomod.cn/api-zlf';17}else if(__PROD__){18 zlf_base_prefix='https://api.zucube.cn';19}20const base_axios_options = {21 withCredentials:true,22 // timeout:TIME_OUT,23 headers: { 'Content-Type': 'application/json' }24};25const customer_base = `${zlf_base_prefix}`;26const customerAxios = axios.create(Object.assign({}, { baseURL: `${customer_base}`}, base_axios_options));27export const customerModule={28 //æ°é»å表29 getNewsList:params => { return customerAxios.get('/article/getByPage', {params:params}).then(res => res.data); },30 //æ°é»è¯¦æ
31 getNewsDetail:params => { return customerAxios.get('/article/getArticleDetail', {params:params}).then(res => res.data); },32 //客æ·æ³¨åæ¥å£33 registerCustorm:params => { return customerAxios.post('/customers/register', params).then(res => res.data); },34 //æ£éªå
¬å¸ååæ¯å¦æ³¨å35 checkInfo:params => { return customerAxios.post('/user/checkInfo', params).then(res => res.data); },36 //è·åéªè¯ç 37 getVerification:params => { return customerAxios.get('/verification', {params:params}).then(res => res.data); },38 //éæ°ç»å®é®ç®±æ¶ è·åéªè¯ç 39 verificationMail:params => { return customerAxios.get('/verificationMail', {params:params}).then(res => res.data); },40 //ä¿®æ¹å¯ç è·åéªè¯ç 41 verificationPass:params => { return customerAxios.get('/verificationPass', {params:params}).then(res => res.data); },42 //ç»å®é®ç®±æ¥å£43 changeMail:params => { return customerAxios.get('/changeMail', {params:params}).then(res => res.data); },44 //ä¿å客æ·ä¿¡æ¯è系人45 saveOrderCustomerInfo:params => { return customerAxios.post('/user/perfectUser', params).then(res => res.data); },46 //ç§èµæµç®ä½éª47 calculation:params => { return customerAxios.post('/calcul/calculation', params).then(res => res.data); },48 //客æ·æ°å»ºé¡¹ç®49 saveCustomerItem:params => { return customerAxios.post('/customers/save', params).then(res => res.data); },50 //è·åææ项ç®51 getOrderInfoList:params => { return customerAxios.get('/customers/getOrderInfoList').then(res => res.data); },52 //è·åç§èµæå¡53 getRentService:params => { return customerAxios.get('/customers/getNewProjectMenu', {params:params}).then(res => res.data); },54 //ä¿å项ç®è系人55 saveProjectPersonInfo:params => { return customerAxios.post('/customers/saveOrderCustomerInfo', params).then(res => res.data); },56 //è·å项ç®è系人57 getOrderCustomerInfo:params => { return customerAxios.get('/customers/getOrderCustomerInfo', {params:params}).then(res => res.data); },58 //è·åç§èµç©59 getLease:params => { return customerAxios.get('/getLease', {params:params}).then(res => res.data); },60 //ä¿åä¾åºåè系人æ¥å£61 changeSupplierUser:params => { return customerAxios.post('/supplier/changeUser', params).then(res => res.data); },62 //ä¿å产åæ¸
å63 saveProductComm:params => { return customerAxios.post('/customers/saveProductComm', params).then(res => res.data); },64 //è·å项ç®è¯¦æ
65 getProjectInfo:params => { return customerAxios.get('/customers/getProjectInfo', {params:params}).then(res => res.data); },66 //è·åæå®ä¾åºåä¿¡æ¯67 getAppointSupplier:params => { return customerAxios.get('/customers/getAppointSupplier', {params:params}).then(res => res.data); },68 //è·åæ¨èä¾åºå69 getRecommendSupplier:params => { return customerAxios.get('/customers/getRecommendSupplier', {params:params}).then(res => res.data); },70 //è·åæå®åä½ä¾åºå产åå表71 getAppointProgress:params => { return customerAxios.get('/customers/getAppointProgress', {params:params}).then(res => res.data); },72 //è·åæ¨èä¾åºå产åå表73 getRecommendProgress:params => { return customerAxios.get('/customers/getRecommendProgress', {params:params}).then(res => res.data); },74 //è·åååä¸ä»æ¬¾75 getContractAndPay:params => { return customerAxios.get('/customers/getContractAndPay', {params:params}).then(res => res.data); },76 //è·å客æ·ååå表77 getCustomerstMainLease:params => { return customerAxios.get('/customers/getMainLease', {params:params}).then(res => res.data); },78 //è·å客æ·åå详æ
79 getMainLeaseDetail:params => { return customerAxios.get('/customers/getMainLeaseDetail', {params:params}).then(res => res.data); },80 //ä¿åéªæ¶ä¿¡æ¯81 acceptance:params => { return customerAxios.post('/customers/acceptance', params).then(res => res.data); },82 //è·åéªæ¶ä¿¡æ¯83 getAcceptanceVO:params => { return customerAxios.get('/customers/getAcceptanceVO', {params:params}).then(res => res.data); },84 //ä¾åºå注å85 registerSupplier:params => { return customerAxios.post('/supplier/register', params).then(res => res.data); },86 //ç»å½æ¥å£87 login:params => { return customerAxios.post('/login?'+ qs.stringify(params)).then(res => res.data); },88 //éåºç»éæ¥å£89 logout:params => { return customerAxios.post('/logout').then(res => res.data); },90 //ä¸ä¼ æ¥å£ 91 upload:params => { return customerAxios.post('/updateContent', params).then(res => res.data); },92 //å¤æ件ä¸ä¼ 93 mulUploadFile:params => { return customerAxios.post('/mulUploadFile', params).then(res => res.data); },94 //è·åå¸åºå®¢æ·ç»é人信æ¯95 getCurrentUser:params => { return customerAxios.post('/getUser').then(res => res.data); },96 //è·åä¾åºåç»é人信æ¯97 getSupplierUser:params => { return customerAxios.get('/supplier/getUser').then(res => res.data); },98 //è·åä¾åºåèµæ99 getDatum:params => { return customerAxios.get('/supplier/getDatum').then(res => res.data); },100 //è·åä¾åºåæ©å±ä¿¡æ¯101 getExtSupplier:params => { return customerAxios.get('/supplier/getExtSupplier').then(res => res.data); },102 //æ¨èå¼å¼å
³103 openRecom:params => { return customerAxios.get('/supplier/openRecom', {params:params}).then(res => res.data); },104 //è·åæ¨èå¼105 getRecommResult:params => { return customerAxios.get('/supplier/getRecommResult').then(res => res.data); },106 //ä¿åæ¨è详æ
107 saveRecommend:params => { return customerAxios.post('/supplier/saveRecommend', params).then(res => res.data); },108 //è·åæ¨è详æ
109 getRecommend:params => { return customerAxios.get('/supplier/getRecommend', {params:params}).then(res => res.data); },110 //è·å交æä¸å¿å表111 getRecommDetail:params => { return customerAxios.get('/supplier/getRecommDetail', {params:params}).then(res => res.data); },112 //è·å项ç®å®¢æ·ä¿¡æ¯113 getCustomerContact:params => { return customerAxios.get('/supplier/getCustomerContact', {params:params}).then(res => res.data); },114 //è·å项ç®å¤§å®¢æ·ä»£è¡¨115 getPlatformContact:params => { return customerAxios.get('/supplier/getPlatformContact', {params:params}).then(res => res.data); },116 //ä¿åååè¿åº¦117 saveContract:params => { return customerAxios.post('/supplier/saveContract', params).then(res => res.data); },118 //è·åååè¿åº¦è¯¦æ
119 getContractProgress:params => { return customerAxios.get('/supplier/getContractProgress', {params:params}).then(res => res.data); },120 //è·åååå表121 getMainLease:params => { return customerAxios.get('/supplier/getMainLease', {params:params}).then(res => res.data); },122 //è·åéªæ¶å®ææ¥å£123 getSupplierAcceptanceVO:params => { return customerAxios.get('/supplier/getAcceptanceVO', {params:params}).then(res => res.data); },124 //ä¿åä¾åºåå®å对æ¥äººä¿¡æ¯125 saveAfterSaleMan:params => { return customerAxios.post('/supplier/saveAfterSaleMan', params).then(res => res.data); },126 //è·åä¾åºåå®å对æ¥äººä¿¡æ¯127 getAfterSaleMan:params => { return customerAxios.get('/supplier/getAfterSaleMan', {params:params}).then(res => res.data); },128 //è·å交æè¿å±æ¥å£129 getProductListComm:params => { return customerAxios.get('/supplier/getProductListComm', {params:params}).then(res => res.data); },130 //è·å客æ·è系人信æ¯131 getCustomerContact:params => { return customerAxios.get('/supplier/getCustomerContact', {params:params}).then(res => res.data); },132 //é请ç 133 relationOrder:params => { return customerAxios.get('/supplier/relationOrder', {params:params}).then(res => res.data); },134 //è·åæ¶æ¯æ¥å£135 getMsg:params => { return customerAxios.get('/msg/getMsg', {params:params}).then(res => res.data); },136 getMsgDetail:params => { return customerAxios.get('/msg/getMsgDetail', {params:params}).then(res => res.data); },137 getNotReadNum:params => { return customerAxios.get('/msg/getNotReadNum', {params:params}).then(res => res.data); },138 //æ¾åå¯ç 139 changePwd:params => { return customerAxios.post('/changePwd?'+ qs.stringify(params)).then(res => res.data); },140 //è·åè¥ä¸æ§ç
§å®¡æ ¸ç¶æ141 getLicenseStatus:params => { return customerAxios.get('/getLicenseStatus', {params:params}).then(res => res.data); },142 //æ£éªéªè¯ç çç¶æ143 checkVerificationCode:params => { return customerAxios.get('/checkVerificationCode', {params:params}).then(res => res.data); },144 //è·åéªåçç¶æ145 factoryInspection:params => { return customerAxios.get('/factoryInspection').then(res => res.data); },146 //æ ¡éªé请ç 147 checkInvitation:params => { return customerAxios.get('/supplier/checkInvitation', {params:params}).then(res => res.data); },148}149export const multipleAxios=(postArray,cb)=>{150 return axios.all(postArray).then(axios.spread(function(){151 cb(...arguments);152 }));153}154customerAxios.interceptors.response.use( (response)=> {155 // 对ååºæ°æ®åç¹ä»ä¹156 if(response.data.statusCode=='401'){157 localStorage.removeItem('role');158 localStorage.removeItem('zlfuserInfo');159 window.location.href='/home.html';160 }161 return response;162 }, (error)=>{163 // 对ååºé误åç¹ä»ä¹164 return Promise.reject(error);...
getData.js
Source:getData.js
...4axios.defaults.withCredentials = true;5/**6 * 1ãç¨æ·èº«ä»½æ¥è¯¢æ¥å£7 */8export const getUserId = (params) => axios.get(domain+'/newMemberCenter/user/getUserIdentity',{9 params:params10 })11 .then(function(response) {12 return response.data13 });14/**15 * 2ãæ ¡åç¨æ·èº«ä»½æ¥è¯¢æ¥å£16 */17export const getUserCampusId = (params) => axios.get(domain+'/newMemberCenter/user/getUserCampusIdentity',{18 params:params19}).then(function(response) {20 return response.data21});22/**23 * 3ãç¨æ·ä¿¡æ¯æ¥è¯¢æ¥å£24 */25export const getUserInfo = (params) => axios.get(domain+'/newMemberCenter/user/getUserInfo',{26 params:params27}).then(function(response) {28 return response.data29});30/**31 * 4ãéå¸æ°éæ¥è¯¢æ¥å£32 */33export const getGoldCoinCount = (params) => axios.get(domain+'/newMemberCenter/getGoldCoinCount',{34 params:params35}).then(function(response) {36 return response.data37});38/**39 * 5ãé¢éæ°éæ¥è¯¢æ¥å£40 */41export const getGBCount = (params) => axios.get(domain+'/newMemberCenter/getGBCount',{42 params:params43}).then(function(response) {44 return response.data45});46/**47 * 6ãå¡å¸æ°éæ¥è¯¢æ¥å£48 */49export const getCouponCount = (params) => axios.get(domain+'/newMemberCenter/getCouponCount',{50 params:params51}).then(function(response) {52 return response.data53});54/**55 * 7ãUPææ°æ¥è¯¢æ¥å£56 */57export const queryMemberGradeValue = (params) => axios.get(domain+'/newMemberCenter/queryMemberGradeValue',{58 params:params59}).then(function(response) {60 return response.data61});62/**63 * 8ãä¼åæçPMæ¥è¯¢æ¥å£64 */65export const getMemberRightsPM = (params) => axios.get(domain+'/newMemberCenter/getMemberRightsPM',{66 params:params67}).then(function(response) {68 return response.data69});70/**71 * 9ãä¼å头é¨å¹¿åä½PMæ¥è¯¢æ¥å£72 */73export const getMemberHeadADPM = (params) => axios.get(domain+'/newMemberCenter/getMemberHeadADPM',{74 params:params75}).then(function(response) {76 return response.data77});78/**79 * 10ãæ ¡åç²¾å广åä½PMæ¥è¯¢æ¥å£80 */81export const getCampusADPM = (params) => axios.get(domain+'/newMemberCenter/getCampusADPM',{82 params:params83}).then(function(response) {84 return response.data85});86/**87 * 11ãä¼åä¼é广åä½PMæ¥è¯¢æ¥å£88 */89export const getMemberPreferencePM = (params) => axios.get(domain+'/newMemberCenter/getMemberPreferencePM',{90 params:params91}).then(function(response) {92 return response.data93});94/**95 * 12ãä¸å±UP计å广åä½æ¥è¯¢æ¥å£96 */97export const getExclusiveUpPlanPM = (params) => axios.get(domain+'/newMemberCenter/getExclusiveUpPlanPM',{98 params:params99}).then(function(response) {100 return response.data101});102/**103 * 13.1æ¥è¯¢ä»»å¡å表104 */105export const queryMission = (params) => axios.get(domain+'/newMemberCenter/mission/queryMission',{106 params:params107}).then(function(response) {108 return response.data109});110/**111 * 13.2æ¥è¯¢ä»»å¡è¯¦æ
112 */113export const queryMissionDetail = (params) => axios.get(domain+'/newMemberCenter/mission/queryMissionDetail',{114 params:params115}).then(function(response) {116 return response.data117});118/**119 * 13.3æ¥åä»»å¡120 */121export const receiveMission = (params) => axios.get(domain+'/newMemberCenter/mission/receiveMission',{122 params:params123}).then(function(response) {124 return response.data125});126/**127 * 13.4é¢åä»»å¡å¥å±128 */129export const rewardMission = (params) => axios.get(domain+'/newMemberCenter/mission/rewardMission',{130 params:params131}).then(function(response) {132 return response.data133});134/**135 * 14.1 æ¥è¯¢éå¸å¤ºå®æ´»å¨å表信æ¯136 */137export const queryActivityList = (params) => axios.get(domain+'/newMemberCenter/queryActivityList',{138 params:params139}).then(function(response) {140 return response.data141});142/**143 * 14.2 æ¥è¯¢éå¸å¤ºå®æ´»å¨è¯¦æ
ä¿¡æ¯144 */145export const queryActivityDetail = (params) => axios.get(domain+'/newMemberCenter/queryActivityDetail',{146 params:params147}).then(function(response) {148 return response.data149});150/**151 * 14.3 ç¨æ·ä¸ååå¼¹çªæ¥å£è¯·æ±å°å152 */153export const queryBasicInfoPreOrder = (params) => axios.get(domain+'/newMemberCenter/activity/queryBasicInfoPreOrder',{154 params:params155}).then(function(response) {156 return response.data157});158/**159 * 14.4 æ°å¢æ追å éå¸å¤ºå®æ¥å£è¯·æ±å°å160 */161export const createOrRebuyOrder = (params) => axios.get(domain+'/newMemberCenter/activity/createOrRebuyOrder',{162 params:params163}).then(function(response) {164 return response.data165});166/**167 * 15.1 å¯ç¨å
æ¢ååå表168 */169export const queryExchangeGoods = (params) => axios.get(domain+'/newMemberCenter/queryExchangeGoods',{170 params:params171}).then(function(response) {172 return response.data173});174/**175 * 15.2 æ¥è¯¢åå详æ
176 */177export const queryExchangeGoodDetail = (params) => axios.get(domain+'/newMemberCenter/queryExchangeGoodDetail',{178 params:params179}).then(function(response) {180 return response.data181});182/**183 * 15.3 éªè¯ååæ¯å¦å¯å
æ¢184 */185export const checkExchangeGood = (params) => axios.get(domain+'/newMemberCenter/checkExchangeGood',{186 params:params187}).then(function(response) {188 return response.data189});190/**191 * 15.4 ååå
æ¢192 */193export const exchange = (params) => axios.get(domain+'/newMemberCenter/exchange',{194 params:params195}).then(function(response) {196 return response.data197});198/**199 * 16 æ¥è¯¢ééè¿ç°æªé¢åæ¥å£200 */201export const queryPlatinumRebateRightsInfo = (params) => axios.get(domain+'/newMemberCenter/queryPlatinumRebateRightsInfo',{202 params:params203}).then(function(response) {204 return response.data205});206/**207 * 17 æ¿æ´»é»é身份208 */209export const ActivateBlack = (params) => axios.get('//vip.jr.jd.com/jsonp/jsonpActivateBlack',{210 params:params211}).then(function(response) {212 return response.data...
UserApi.js
Source:UserApi.js
...4 static loginUser(user) {5 return axios.post(`${API_BASE}/api/user/login`, user);6 }7 static getCurrentUser() {8 return axios.get(`${API_BASE}/api/user`,{withCredentials:true});9 }10 static logoutUser(user) {11 return axios.post(`${API_BASE}/api/restaurant/search`, {12 username:user.email,13 password:user.password14 });15 }16 static signUpUser(user) {17 return axios.post(`${API_BASE}/api/user/register`, user);18 }19 static createMyAddress(address, userId) {20 return axios.post(`${API_BASE}/api/user/${userId}/address/create`, address);21 }22 static updateMyAddress(address,userId) {23 return axios.post(`${API_BASE}/api/user/${userId}/address/update`, address);24 }25 static createMyPhone(phone,userId) {26 return axios.post(`${API_BASE}/api/user/${userId}/phone/create`, phone);27 }28 static updateMyPhone(phone,userId) {29 return axios.post(`${API_BASE}/api/user/${userId}/phone/update`, phone);30 }31 static getRestaurantsForManagerSignup() {32 return axios.get(`${API_BASE}/api/user/restaurants/unmanaged`);33 }34 static getRestaurantsForOwnerSignup() {35 return axios.get(`${API_BASE}/api/restaurant/db/lazy`);36 }37 // Manager page38 static getRestaurantDetailsForManager(managerId) {39 return axios.get(`${API_BASE}/api/user/${managerId}/restaurant`);40 }41 static getPendingOrdersForManager(managerId) {42 return axios.get(`${API_BASE}/api/user/${managerId}/restaurant/orders/pending`);43 }44 static getAllOrdersForManager(managerId) {45 return axios.get(`${API_BASE}/api/user/${managerId}/restaurant/orders`);46 }47 static getAvailableDeliveryBoys() {48 return axios.get(`${API_BASE}/api/user/deliveryBoys`);49 }50 static assignOrderToDeliveryBoy(deliveryBoyId,orderId) {51 return axios.get(`${API_BASE}/api/user/deliveryBoy/${deliveryBoyId}/${orderId}`);52 }53 static getDeliveryBoyAssignedOrders(deliveryBoyId) {54 return axios.get(`${API_BASE}/api/user/deliveryBoy/order/${deliveryBoyId}`);55 }56 static getOrderAssignedToMe(deliveryBoyId) {57 return axios.get(`${API_BASE}/api/user/${deliveryBoyId}/order`);58 }59 static markOrderAsDelivered(orderId) {60 return axios.get(`${API_BASE}/api/restaurant/order/deliver/${orderId}`);61 }62 static deleteAddress(userId,addressId) {63 return axios.get(`${API_BASE}/api/user/${userId}/address/${addressId}/delete`);64 }65 static deletePhone(userId,phoneId) {66 return axios.get(`${API_BASE}/api/user/${userId}/phone/${phoneId}/delete`);67 }68 static updateMyProfile(user) {69 return axios.post(`${API_BASE}/api/user/profile/update`,user);70 }71 // Admin72 static getAllUsers() {73 return axios.get(`${API_BASE}/api/admin/users`);74 }75 static getAllRestaurants() {76 return axios.get(`${API_BASE}/api/restaurant/db/lazy`);77 }78 static getOwnerRestaurants(ownerId) {79 return axios.get(`${API_BASE}/api/user/owner/restaurants/${ownerId}`);80 }81 static getAllApprovals() {82 return axios.get(`${API_BASE}/api/admin/approvals/pending`);83 }84 static deleteUser(userId) {85 return axios.get(`${API_BASE}/api/admin/user/delete/${userId}`);86 }87 static getSelectedUserDetails(userId) {88 return axios.get(`${API_BASE}/api/user/details/${userId}`);89 }90 // menu item CRUD91 static createMenuItem(menuItem, menuId) {92 return axios.post(`${API_BASE}/api/admin/item/create/${menuId}`, menuItem);93 }94 static updateMenuItem(menuItem) {95 return axios.post(`${API_BASE}/api/admin/item/update`, menuItem);96 }97 static deleteMenuItem(menuItemId) {98 return axios.get(`${API_BASE}/api/admin/item/delete/${menuItemId}`);99 }100 static approveOwnership(ownerId, restaurantKey) {101 return axios.get(`${API_BASE}/api/admin/approval/approve/${ownerId}/${restaurantKey}`);102 }103 static rejectOwnership(ownerId, restaurantKey) {104 return axios.get(`${API_BASE}/api/admin/approval/reject/${ownerId}/${restaurantKey}`);105 }106 static deleteRestaurant(restaurantKey) {107 return axios.get(`${API_BASE}/api/admin/restaurant/delete/${restaurantKey}`);108 }109 static requestOwnerShip(ownerId, restaurantKey) {110 return axios.get(`${API_BASE}/api/user/${ownerId}/own/restaurant/${restaurantKey}`);111 }112 static unAssignOwnership(ownerId, restaurantKey) {113 return axios.get(`${API_BASE}/api/user/owner/unassign/${ownerId}/${restaurantKey}`);114 }115 static getUnOwnedRestaurants(ownerId) {116 return axios.get(`${API_BASE}/api/user/restaurants/unowned/${ownerId}`);117 }118 // Followers119 static getIamFollowing(userId) {120 return axios.get(`${API_BASE}/api/user/followings/${userId}`);121 }122 static followCustomer(userId, toBeFollowedId) {123 return axios.get(`${API_BASE}/api/user/follow/${userId}/${toBeFollowedId}`);124 }125 static unfollowCustomer(userId, toBeUnFollowedId) {126 return axios.get(`${API_BASE}/api/user/unfollow/${userId}/${toBeUnFollowedId}`);127 }128 static getMyListOfOrders(userId) {129 return axios.get(`${API_BASE}/api/user/order/${userId}`);130 }131 static adminCreateUser(user) {132 return axios.post(`${API_BASE}/api/admin/user/create`, user);133 }134}...
store.js
Source:store.js
...12 },13 actions: {14 // eslint-disable-next-line15 getKhg({}){16 return axios.get(`${M_API}/costByActivity`)17 .then(res => {18 return res.data19 })20 // .catch(err => Promise.reject(err))21 },22 getAnggaran({ }){23 return axios.get(`${M_API}/anggaran`)24 .then(res => {25 return res.data26 })27 },28 provinces({ }) {29 return axios.get(`${M_API}/provinces`)30 .then(res => {31 return res.data32 })33 },34 getPlanningAnggaran({ }) {35 return axios.get(`${M_API}/peatlandrewetting`)36 .then(res => {37 return res.data38 })39 40 },41 getPlanningrevegetasi({ }) {42 return axios.get(`${M_API}/revegetation`)43 .then(res => {44 return res.data45 })46 47 },48 getPlanningrevitalization({ }) {49 return axios.get(`${M_API}/revitalization`)50 .then(res => {51 return res.data52 })53 54 },55 56 getPlanningStabilization({ }) {57 return axios.get(`${M_API}/baseStabilization`)58 .then(res => {59 return res.data60 })61 62 },63 getPlanninginstStrengthening({ }) {64 return axios.get(`${M_API}/instStrengthening`)65 .then(res => {66 return res.data67 })68 69 },70 getPlanningcoopImprove({ }) {71 return axios.get(`${M_API}/coopImprove`)72 .then(res => {73 return res.data74 })75 76 },77 getPlanningactifRoles({ }) {78 return axios.get(`${M_API}/actifRoles`)79 .then(res => {80 return res.data81 })82 83 },84 getPlanningpeatlandRestoration({ }) {85 return axios.get(`${M_API}/peatlandRestoration`)86 .then(res => {87 return res.data88 })89 90 },91 getPlanningadminstrartionManagement({ }) {92 return axios.get(`${M_API}/administrationManagement`)93 .then(res => {94 return res.data95 })96 97 },98 // eslint-disable-next-line99 getPlanningCost({ }) {100 return axios.get(`${M_API}/totalcost`)101 .then(res => {102 return res.data103 })104 .catch(err => Promise.reject(err))105 },106 totalkegiatan({ }) {107 return axios.get(`${M_API}/totalkegiatan`)108 .then(res => {109 return res.data110 })111 .catch(err => Promise.reject(err))112 },113 114 totallembaga({ }) {115 return axios.get(`${M_API}/totallembaga`)116 .then(res => {117 return res.data118 })119 .catch(err => Promise.reject(err))120 },121 // eslint-disable-next-line122 getPlanningCostByProvince({ }) {123 return axios.get(`${M_API}/costByProvince`)124 .then(res => {125 return res.data126 })127 .catch(err => Promise.reject(err))128 },129 // eslint-disable-next-line130 getPlanningCostByKegiatan({ }) {131 return axios.get(`${M_API}/costByActivity`)132 .then(res => {133 return res.data134 })135 .catch(err => Promise.reject(err))136 },137 // eslint-disable-next-line138 getPlanningAreaByProvince({ }) {139 return axios.get(`${M_API}/area-by-province-plan`)140 .then(res => {141 return res.data142 })143 .catch(err => Promise.reject(err))144 },145 // eslint-disable-next-line146 getPlanningAction({ }) {147 return axios.get(`${M_API}/total-action-plan`)148 .then(res => {149 return res.data150 })151 .catch(err => Promise.reject(err))152 },153 // eslint-disable-next-line154 getPlanningActionByProvince({ }) {155 return axios.get(`${M_API}/action-by-province-plan`)156 .then(res => {157 return res.data158 })159 .catch(err => Promise.reject(err))160 },161 // eslint-disable-next-line162 getPlanningCostByFundingSource({ }) {163 return axios.get(`${M_API}/cost-by-funding-source-plan`)164 .then(res => {165 return res.data166 })167 .catch(err => Promise.reject(err))168 },169 }170}...
api.js
Source:api.js
...22export const requestLogin = params => {23 return axios.post(`${base}/user/login`, params).then(res => res.data);24};25export const getFlyerJobListPage = params => {26 return axios.get(`${base}/flyerJob/listpage`, {params: params});27};28export const removeFlyerJob = params => {29 return axios.get(`${base}/flyerjob/remove`, {params: params});30};31export const operateFlyerJob = params => {32 return axios.get(`${base}/flyerjob/operate`, {params: params});33};34export const runFlyerJobNow = params => {35 return axios.get(`${base}/flyerjob/runnow`, {params: params});36};37export const cancelFlyerJobNow = params => {38 return axios.get(`${base}/flyerjob/cancel`, {params: params});39};40export const batchRemoveFlyerJob = params => {41 return axios.get(`${base}/flyerjob/batchremove`, {params: params});42};43export const editFlyerJob = params => {44 return axios.post(`${base}/flyerjob/edit`, params);45};46export const addFlyerJob = params => {47 return axios.get(`${base}/flyerjob/add`, {params: params});48};49export const listClient = params => {50 return axios.get(`${base}/flyerjob/clients`, {params: params});51};52//record53export const listRecord = params => {54 return axios.get(`${base}/record/list`, {params: params});55};56// app57export const getAppListPage = params => {58 return axios.get(`${base}/app/listpage`, {params: params});59};60export const getAppList = params => {61 return axios.get(`${base}/app/list`);62};63export const addApp = params => {64 return axios.get(`${base}/app/add`, {params: params});65};66export const editApp = params => {67 return axios.post(`${base}/app/edit`, params);68};69export const removeApp = params => {70 return axios.get(`${base}/app/remove`, {params: params});71};72export const batchRemoveApp = params => {73 return axios.get(`${base}/app/batchremove`, {params: params});74};75// user76export const getUserListPage = params => {77 return axios.get(`${base}/user/listpage`, {params: params});78};79export const getUserList = params => {80 return axios.get(`${base}/user/list`);81};82export const addUser = params => {83 return axios.get(`${base}/user/add`, {params: params});84};85export const editUser = params => {86 return axios.post(`${base}/user/edit`, params);87};88export const removeUser = params => {89 return axios.get(`${base}/user/remove`, {params: params});90};91//cluster92export const getCluster = params => {93 return axios.get(`${base}/cluster/show`);94};95export const editCluster = params => {96 return axios.get(`${base}/cluster/save`, {params: params});...
spotifyRequest.test.js
Source:spotifyRequest.test.js
1const axios = require ('axios');2jest.mock('../database/users.js');3jest.mock('axios')4jest.mock('../spotify/spotifyRequest.js');5process.env.CLIENT_ID = "client_id_mock"6process.env.CLIENT_SECRET = "client_secret_mock"7process.env.SPOTIFY_REDIRECT = "SPOTIFY_REDIRECT_mock"8const spotifyRequest = require ('../spotify/spotifyRequest');9const {10 getFromSpotifyWithLimits,11 getFromSpotify,12 getFromSpotifyByIds13} = jest.requireActual('../spotify/spotifyRequest');14describe('module spotifyRequest', () => {15 beforeEach(() => {16 jest.resetAllMocks('axios')17 })18 describe('function getFromSpotify', () => {19 it('should call axios.get', () => {20 return getFromSpotify('some random url', 'random token')21 .then(results => {22 expect(axios.get).toHaveBeenCalledTimes(1);23 })24 })25 it('should have called axios.get with arguments', () => {26 const args = {27 url: 'urlArg',28 token: 'tokenArg',29 options: {30 params: {31 }32 }33 }34 const request = getFromSpotify(args.url, args.token, args.options);35 return request.then (results => {36 expect(axios.get).toHaveBeenCalledWith(args.url, expect.any(Object))37 })38 })39 it('should have returned a promise', () => {40 expect(getFromSpotify()).toBeInstanceOf(Promise);41 })42 it('should return data property from axios.get', () => {43 const mockedData = {44 arg1: 'test1',45 arg2: 'test2'46 }47 axios.get.mockReturnValueOnce(Promise.resolve({data: mockedData}))48 return getFromSpotify('someUrl', 'token')49 .then(data => {50 expect(data).toStrictEqual(mockedData);51 expect(data).toStrictEqual(expect.objectContaining({52 arg1: 'test1',53 arg2: 'test2'54 }))55 })56 })57 })58 describe('function getFromSpotifyWithLimits', () => {59 it('should return a promise', () => {60 expect(getFromSpotifyWithLimits()).toBeInstanceOf(Promise);61 })62 it('should call axios one time', () => {63 axios.get.mockResolvedValueOnce({data: {items: ['test', 'test2'], next: null}})64 return getFromSpotifyWithLimits('url', 'token', {params: {ids: ['setst', 'ewtewt']}})65 .then(results => {66 return expect(axios.get).toHaveBeenCalledTimes(1);67 })68 })69 it('should call axios 2 times when returned with next url', () => {70 axios.get.mockClear();71 const response1 = {data: {72 items: [],73 next: 'weirdURL'74 }}75 const response2 = {76 data: {77 items: [],78 next: null79 }80 }81 axios.get.mockResolvedValueOnce(response1);82 axios.get.mockResolvedValueOnce(response2);83 return getFromSpotifyWithLimits('url', 'token')84 .then(items => {85 return expect(axios.get).toHaveBeenCalledTimes(2);86 })87 })88 })89 describe('function getFromSpotifyByIds', () => {90 })...
index.js
Source:index.js
2const API_ENDPOINT = process.env.API_ENDPOINT;3const TILE_ENDPOINT = process.env.TILE_ENDPOINT;4const CLOUDSEARCH_ENDPOINT = process.env.CLOUDSEARCH_ENDPOINT;5export const exploracion = {6 getLayers: (locationType) => axios.get(`${API_ENDPOINT}/exploracion/layers`, {7 params: { locationType }8 }),9 getLocation: (locationType, id) => axios.get(`${API_ENDPOINT}/exploracion/location`, {10 params: { locationType, id }11 }),12 getSuggestions: str => axios.get(`${CLOUDSEARCH_ENDPOINT}`, {13 params: {14 q: `${str}*|${str}`,15 'q.parser': 'simple',16 'q.options': {17 'defaultOperator': 'and',18 'fields': ['nombre'],19 'operators': ['and', 'escape', 'fuzzy', 'near', 'not', 'or', 'phrase', 'precedence', 'prefix', 'whitespace']20 },21 return: '_all_fields,_score',22 sort: '_score desc',23 'highlight.nombre': {24 'max_phrases': 3,25 'format': 'text',26 'pre_tag': '*#*',27 'post_tag': '*%*'28 }29 }30 }),31 getVector: (field, locationType) => {32 return axios.get(`${API_ENDPOINT}/exploracion/test`, { 33 params: { locationType, field } 34 });35 }36};37export const monitoreo = {38 getVector: (caseID, index ) => axios.get(`${API_ENDPOINT}/monitor/vector`, {39 params: { caseID, index }40 }),41 getLocation: (locationType, id) => axios.get(`${API_ENDPOINT}/exploracion/location`, {42 params: { locationType, id }43 }),44};45export const ubicacion = {46 municipio: {47 getBasicInformation: id => axios.get(`${API_ENDPOINT}/municipio/${id}/general`),48 getConevalInformation: id => axios.get(`${API_ENDPOINT}/municipio/${id}/coneval`),49 getFeatures: id => axios.get(`${API_ENDPOINT}/municipio/${id}/localidades`),50 getGeoJSON: id => axios.get(`${API_ENDPOINT}/municipio/${id}/geojson`),51 getRiesgoMunicipio: id => axios.get(`${API_ENDPOINT}/municipio/${id}/riesgo`),52 getCobertura: id => axios.get(`${API_ENDPOINT}/municipio/${id}/cobertura`),53 getRecomendacion: id => axios.get(`${API_ENDPOINT}/municipio/${id}/recomendacion`),54 getCoberturaDict: id => axios.get(`${API_ENDPOINT}/informacion/cobertura`)55 },56 estado: {57 getBasicInformation: id => axios.get(`${API_ENDPOINT}/estado/${id}/general`),58 getConevalInformation: id => axios.get(`${API_ENDPOINT}/estado/${id}/coneval`),59 getFeatures: id => axios.get(`${API_ENDPOINT}/estado/${id}/municipios`),60 getGeoJSON: id => axios.get(`${API_ENDPOINT}/estado/${id}/geojson`),61 getRiesgoMunicipio: id => axios.get(`${API_ENDPOINT}/estado/${id}/riesgo`),62 getCobertura: id => axios.get(`${API_ENDPOINT}/estado/${id}/cobertura`),63 getRecomendacion: id => axios.get(`${API_ENDPOINT}/estado/${id}/recomendacion`),64 getCoberturaDict: id => axios.get(`${API_ENDPOINT}/informacion/cobertura`)65 }...
used-props.service.js
Source:used-props.service.js
1import Axios from 'axios';2const USER = 'users/';3const PROPS = 'props/';4const USED = 'used/';5const COUNT = 'count';6const props = {7 fetch(num, page, approved) {8 return Axios.get(`${PROPS}${USED}?num=${num}&page=${page}&approved=${approved}`);9 },10 fetchAll(num, page) {11 return Axios.get(`${PROPS}${USED}?num=${num}&page=${page}&all=true`);12 },13 fetchByUser(num, page, user, approved) {14 return Axios.get(`${USER}${user}/${PROPS}?num=${num}&page=${page}&approved=${approved}`);15 },16 fetchByUserAll(num, page, user) {17 return Axios.get(`${USER}${user}/${PROPS}?num=${num}&page=${page}&all=true`);18 },19 fetchByCategory(num, page, category, approved) {20 return Axios.get(`${PROPS}${USED}?num=${num}&page=${page}&category=${category}&approved=${approved}`);21 },22 fetchByCategoryAll(num, page, category) {23 return Axios.get(`${PROPS}${USED}?num=${num}&page=${page}&category=${category}&all=true`);24 },25 fetchByUserAndCategory(num, page, user, category, approved) {26 return Axios.get(`${USER}${user}/${PROPS}?num=${num}&page=${page}&category=${category}&approved=${approved}`);27 },28 fetchByUserAndCategoryAll(num, page, user, category) {29 return Axios.get(`${USER}${user}/${PROPS}?num=${num}&page=${page}&category=${category}&all=true`);30 },31 post(data) {32 return Axios.post(`${PROPS}${USED}`, data);33 },34 review(id, data) {35 return Axios.put(`${PROPS}${USED}${id}/review`, data);36 },37 delete(id) {38 return Axios.delete(`${PROPS}${USED}${id}`);39 },40 put(id, data) {41 return Axios.put(`${PROPS}${USED}${id}`, data);42 }43};44const count = {45 fetch(approved) {46 return Axios.get(`${PROPS}${USED}${COUNT}?approved=${approved}`);47 },48 fetchAll() {49 return Axios.get(`${PROPS}${USED}${COUNT}&all=true`);50 },51 fetchByUser(user, approved) {52 return Axios.get(`${USER}${user}/${PROPS}${COUNT}?approved=${approved}`);53 },54 fetchByUserAll(user) {55 return Axios.get(`${USER}${user}/${PROPS}${COUNT}?all=true`);56 },57 fetchByCategory(category, approved) {58 return Axios.get(`${PROPS}${USED}${COUNT}?category=${category}&approved=${approved}`);59 },60 fetchByCategoryAll(category) {61 return Axios.get(`${PROPS}${USED}${COUNT}?category=${category}&all=true`);62 },63 fetchByUserAndCategory(user, category, approved) {64 return Axios.get(`${USER}${user}/${PROPS}${COUNT}?category=${category}&approved=${approved}`);65 },66 fetchByUserAndCategoryAll(user, category) {67 return Axios.get(`${USER}${user}/${PROPS}${COUNT}?category=${category}&all=true`);68 }69};70export {71 props,72 count...
Using AI Code Generation
1var axios = require('axios');2var config = {3 headers: { }4};5axios(config)6.then(function (response) {7 console.log(JSON.stringify(response.data));8})9.catch(function (error) {10 console.log(error);11});12{"build":{"version":"1.20.2","revision":"a6b8d8e","time":"2020-12-08T20:17:09.000Z"},"os":{"arch":"x64","name":"Linux","version":"4.15.0-142-generic"},"java":{"version":"
Using AI Code Generation
1const axios = require('axios');2const axiosInstance = axios.create({3 headers: {4 }5});6const data = {7 "desiredCapabilities": {8 }9};10axiosInstance.post('/session', data)11 .then((response) => {12 console.log(response.data);13 })14 .catch((error) => {15 console.log(error);16 });17const axios = require('axios');18const axiosInstance = axios.create({19 headers: {20 }21});22const data = {23 "desiredCapabilities": {24 }25};26axiosInstance.post('/session', data)27 .then((response) => {28 console.log(response.data);29 })30 .catch((error) => {31 console.log(error);32 });33const axios = require('axios');34const axiosInstance = axios.create({35 headers: {36 }37});38const data = {39 "desiredCapabilities": {
Using AI Code Generation
1var axios = require('axios');2axios.get(url).then(function(response) {3 console.log(response.data);4}).catch(function(error) {5 console.log(error);6});7var axios = require('axios');8axios.post(url).then(function(response) {9 console.log(response.data);10}).catch(function(error) {11 console.log(error);12});13var axios = require('axios');14axios.post(url).then(function(response) {15 console.log(response.data);16}).catch(function(error) {17 console.log(error);18});19var axios = require('axios');20axios.post(url).then(function(response) {21 console.log(response.data);22}).catch(function(error) {23 console.log(error);24});25var axios = require('axios');26axios.post(url).then(function(response) {27 console.log(response.data);28}).catch(function(error) {29 console.log(error);30});31var axios = require('axios');32axios.post(url).then(function(response) {33 console.log(response.data);34}).catch(function(error) {35 console.log(error);36});37var axios = require('axios');38axios.post(url).then(function(response) {39 console.log(response.data);40}).catch(function(error) {41 console.log(error);42});43var axios = require('axios');
Using AI Code Generation
1var axios = require('axios');2axios.get(url)3 .then(function(response) {4 console.log(response.data);5 })6 .catch(function(error) {7 console.log(error);8 });9var axios = require('axios');10axios.post(url, {11 desiredCapabilities: {12 }13})14 .then(function(response) {15 console.log(response.data);16 })17 .catch(function(error) {18 console.log(error);19 });20var axios = require('axios');21axios.delete(url)22 .then(function(response) {23 console.log(response.data);24 })25 .catch(function(error) {26 console.log(error);27 });28var axios = require('axios');29axios.get(url)30 .then(function(response) {31 console.log(response.data);32 })33 .catch(function(error) {34 console.log(error);35 });36var axios = require('axios');37axios.delete(url)38 .then(function(response
Using AI Code Generation
1var axios = require('axios');2console.log(currentActivity.data.value);3var axios = require('axios');4console.log(currentActivity.data.value);5var axios = require('axios');6console.log(currentActivity.data.value);7var axios = require('axios');8console.log(currentActivity.data.value);9var axios = require('axios');10console.log(currentActivity.data.value);11var axios = require('axios');12console.log(currentActivity.data.value);13var axios = require('axios');14console.log(currentActivity.data.value);15var axios = require('axios');16console.log(currentActivity.data.value);
Using AI Code Generation
1const axios = require('axios');2axios.get(url)3 .then((response) => {4 console.log(response.data);5 })6 .catch((error) => {7 console.log(error);8 });
Using AI Code Generation
1var axios = require('axios');2var status = async function () {3 try {4 return response.data.status;5 } catch (error) {6 return error;7 }8};9module.exports = status;10var appiumStatus = require('./appiumStatus');11var assert = require('assert');12describe('Test Appium Status', function () {13 it('should return 0', async function () {14 var res = await appiumStatus();15 assert.equal(res, 0);16 });17});18var axios = require('axios');19var status = async function () {20 try {21 return response.data.status;22 } catch (error) {23 return error;24 }25};26module.exports = status;27var appiumStatus = require('./appiumStatus');28var assert = require('assert');29describe('Test Appium Status', function () {30 it('should return 0', async function () {31 var res = await appiumStatus();32 assert.equal(res, 0);33 });34});35var axios = require('axios');36var status = async function () {37 try {38 return response.data.status;39 } catch (error) {40 return error;41 }42};43module.exports = status;44var appiumStatus = require('./appiumStatus');45var assert = require('assert');46describe('Test Appium Status', function () {47 it('
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!