Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// import cheerio from 'react-native-cheerio'; // tslint:disable-line import-name
import { AsyncStorage } from 'react-native';
import { Sentry } from 'react-native-sentry';
import firebase from 'react-native-firebase';
import config from 'config';
let token;
const ref = firebase.firestore().collection('metadata');
const getKey = url => `MetaData_${url}`;
export const fetchMetadataCache = async (url: string) => {
const cached = await AsyncStorage.getItem(getKey(url));
try {
if (cached) {
return JSON.parse(cached);
}
} catch (err) {}
return;
};
export default async (url: string) => {
.then(result => {
this.setState({ loading: false });
var user = result.user;
AsyncStorage.setItem("@loggedInUserID:id", user.uid);
var userDict = {
id: user.uid,
fullname: user.displayName,
email: user.email,
photoURL: user.photoURL
};
var data = {
...userDict,
appIdentifier: "rn-android-universal-listings"
};
console.log("data", data);
firebase
.firestore()
.collection("users")
.doc(user.uid)
.set(data);
this.props.navigation.dispatch({
type: "Login",
user: userDict
});
})
.catch(error => {
static productsCollection() {
return firebase.firestore().collection('products');
}
constructor() {
this.firestore = firebase.firestore();
}
const userObject = firebase.auth().currentUser;
if (userObject) {
user = userObject.uid;
}
const {
date,
notes,
address,
lon,
lat,
city,
chosenCity,
} = report;
return firebase
.firestore()
.collection(reportsRefName())
.add({
date,
notes,
address,
addressCity: city,
lon,
lat,
chosenCity,
image: firebaseImageURI,
user,
});
};