標籤:
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