In my React Native App, I'm using apisauce to communicate with my API and trying to get baseURL from firebase firestore. Do do this I'm using anonymous signing in to access the database. I'm getting TypeError as mentioned in question title. Please help me out.

import {create} from 'apisauce';
import auth from '@react-native-firebase/auth';
import firestore from '@react-native-firebase/firestore';

const apiClient = create({
  method: 'POST',
  baseURL: '',
}).setBaseURL(
  async () =>
    await auth()
      .signInAnonymously()
      .then(async () => {
        console.log('success');
        await firestore()
          .collection('service_url')
          .doc('service_url')
          .get()
          .then(async document => {
            await document._data.url.toString();
          })
          .catch(error => console.log(error));
      })
      .catch(error => {
        console.log(error);
      }),
);

export default apiClient;
0

There are 0 best solutions below