在我的 React Native App 中,我使用 apisauce 与我的 API 通信并尝试从 firebase firestore 获取 baseURL。这样做我使用匿名登录来访问数据库。我收到了问题标题中提到的 TypeError 。请帮帮我。
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;