I am using firebase to insert the user into database , name , email , ip ect, to get the IP i am using react native public ip that contains publicIP function that Returns a Promise for the IP address, my issue is that firebase fires an error saying that
reference set failed : first argument contains undefined ..
const ip = getIP();
firebase.database().ref(`mydatabase/${userId}`)
.set({ name ,email,ip,radio,backgr})
.then( async() => { dispatch({ type: SIGNUP_SUCCESS });
})
.catch(error => handleError(dispatch, error.message));
}
const getIP = () => {
let ipz = '111.11.111.11';
publicIP()
.then(ip => {
myipx(ip);
})
.catch(error => {
ipz = 'noIp';
});
};
const myipx = ip => {
return ip;
}