react native 网络get请求方式参数不可为undefined或null
Posted 编程随想曲
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react native 网络get请求方式参数不可为undefined或null相关的知识,希望对你有一定的参考价值。
react native 网络get请求方式参数不可为undefined(为空的话默认变为)或null
错误写法:
export function addToCartAction(isRefreshing, loading, spId, number, spfId = null, pgId = null) { console.warn(‘==>‘,spId+":"+number); return (isRefreshing || loading) ? {types: [FETCH_ADD_TO_CART.code, SUCCESS_ADD_TO_CART, FAILURE_ADD_TO_CART], callAPI: () => request(FETCH_ADD_TO_CART.url+‘?spId=‘+spId+‘&number=‘+number+‘&spfId=‘+spfId+‘&pgId=‘+pgId), payload: {isRefreshing, loading} } : {type: CLEAR_ADD_TO_CART, isRefreshing, loading}; }
正确写法:
export function addToCartAction(isRefreshing, loading, spId, number) { console.warn(‘==>‘,spId+":"+number); return (isRefreshing || loading) ? {types: [FETCH_ADD_TO_CART.code, SUCCESS_ADD_TO_CART, FAILURE_ADD_TO_CART], callAPI: () => request(FETCH_ADD_TO_CART.url+‘?spId=‘+spId+‘&number=‘+number), payload: {isRefreshing, loading} } : {type: CLEAR_ADD_TO_CART, isRefreshing, loading}; }
以上是关于react native 网络get请求方式参数不可为undefined或null的主要内容,如果未能解决你的问题,请参考以下文章