Questions tagged [apisauce]
34 questions
5
votes
0 answers
Why have Network Error on https apisauce call
I have an expo react native app that works fine with apisauce and http connection but when i set a https baseurl it shows me network-error but on postman the same call works fine.
error example image
const apiClient = create({
baseURL:…

Maxi Aringoli
- 67
- 3
5
votes
1 answer
I need to call a mobx action from inside axios interceptor
When an API returns a 401, I want to force logout the user. The following code is written inside a React Native Ignite project using Mobx
import { useStores } from "../../models"
this.apisauce.axiosInstance.interceptors.response.use(response => {
…

AnonymousSB
- 3,516
- 10
- 28
3
votes
0 answers
Unable to render data to ReactNative FlatList on Scroll down using Http POST request
I want to render a list of items in a ReactNative FlatList, initially I am loading 15 items and then load more when user scrolls down. I am using FlatList's onEndReached prop to get new items on scroll. I am consuming an api with POST method, which…

Venkatesh Pottabathini
- 31
- 1
- 7
3
votes
2 answers
OnUploadProgress is only called once
I'm trying to track the progress of data upload on my react native app. I use the plugin apiSauce to call my server running locally (node server with baseURL : 192.xxx.x.xx":9000/).
On the front part I called my api using 'apisauce' with the code…

LePetitPrince
- 33
- 5
2
votes
1 answer
How to add query, filter params in axios request
http://localhost:9000/api/res.users?sudo=1&filter=[["id","=",11]]&query={id,name,image_128,phone}
how to compose above url with axios and send it to server.
i tried params but i think i'm missing something because i'm getting
Promise {
"_U":…

Marijani Ramadhan
- 23
- 1
- 5
2
votes
1 answer
https doesnt work on react-native android
When i try to get a request to my api via https protocol it doesnt work (NETWORK_ERROR returns), but if i do it via http it works fine. Im using apisauce. What i've tried:
do request to https://my.api.url via postman - works fine
do request to…

tzi0
- 537
- 2
- 5
- 12
2
votes
1 answer
React Native app cannot reach backend API on Android, without using Charles + SSL tunnelling
My RN app works perfectly on iOS. But on Android, it cannot reach the backend (hosted in cloud using https) or any other URL like https://randomuser.me/api
But when I make the device use Charles as HTTP proxy, install the Charles root certificate…

Esben von Buchwald
- 2,772
- 1
- 29
- 37
2
votes
1 answer
Is axios convert 0 to null in response?
Hello everyone i'm working with apisause(axios wrapper) and calling an api to get statistics, the results is numbers always but i have a special case when the result is 0 axios somehow convert it into null
here is the response from Preview Tap
and…

Mohammed Saber Mohammed
- 303
- 4
- 16
2
votes
2 answers
How do i pass a bearer authorization token with ApiSauce
Please help check if the method i used to pass the bearer authorization token, because its not working, Maybe im missing something please
apiClient.addAsyncRequestTransform(async (request) => {
const authToken = await authStorage.getToken();
if…

Nelson Kehinde
- 233
- 2
- 10
2
votes
3 answers
how to fix network error on Apisauce when coonecting with backend
I am using API sauce to to connect to my backend, I have double checked all my paramaters are they are coming, tested with Postman as well and it all works. It just doesnt connect to the backend for whatever reason, when i console.log the result im…

Nelson Kehinde
- 233
- 2
- 10
2
votes
1 answer
Not able to install apisauce in react-native project
I tried to install using the following code:
npm i apisauce --save
However, I got these errors:
npm WARN react-navigation-stack@2.8.2 requires a peer of
react-navigation@^4.1.1 but none is installed. You must install peer
dependencies…

Ravikant Chaudhary
- 43
- 1
- 6
1
vote
0 answers
How do you type hint overriding a built in axios method that returns a promise?
I've been trying to add a caching layer to apisauce.
I followed a guide on https://techblog.geekyants.com/a-guide-to-react-native-offline-support which gave me the following code:
import {create} from 'apisauce';
import cache from…

Daniel P
- 2,439
- 3
- 20
- 27
1
vote
2 answers
Conditionally create json object
I'm using APISauce to create a post request to my server.
This works fine, and id, title and desc are variables that I pass in a function.
return client.post("/workout", {
userId: id,
title: title,
description: desc,
});
description is optional, and…

theabrar
- 360
- 1
- 6
- 15
1
vote
0 answers
Slow Post request in React Native
I am making a post request in react-native using apisauce, but the request is too slow. The request takes around 1000ms in Postman, but is slower in react-native. How can I optimize this?
My sample response data is like
[
{
"email":…

Rohit Aggarwal
- 1,048
- 1
- 14
- 32
0
votes
0 answers
SyntaxError: Unexpected token 'n', "#" is not valid JSON (React Native app)
I am trying to create an app using react native as the front end and node.js + express + mongoDB as the backend. I have no issues viewing the data from mongoDB in react native, my issue is when I try posting data to the database, every time I get…

Omar Osama
- 23
- 5