Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
upgradeAccountWithToken: async (token, { facebook }) => {
if (!token && (!facebook || !facebook.token)) {
console.warn("upgradeAccountWithToken: Can't upgrade account without a token");
return;
}
const _token = token || facebook.token;
try {
const user = await linkAndRetrieveDataWithToken(_token);
console.log('upgradeAccountWithToken: Upgraded Successful');
dispatch.facebook.authorized(user);
} catch ({ message, code, ...error }) {
if (code === 'auth/credential-already-in-use') {
// Delete current account while signed in
// TODO: This wont work
const uid = Fire.shared.uid;
if (uid) {
console.log('Should delete:', uid);
await deleteUserAsync(uid);
console.log('All deleted');
} else {
console.log('??? do something:', uid);
}
await dispatch.facebook.loginToFirebaseWithToken(_token);
} else {
// If the account is already linked this error will be thrown
console.log('Error: upgradeAccountWithToken', message);
_onPress = () => {
dispatch.facebook.upgradeAccount();
};
_onLogout = () => {
_onPress = () => {
dispatch.facebook.upgradeAccount();
};
_onLogout = () => {
upgradeAccount = async () => {
dispatch.facebook.upgradeAccount();
};
upgradeAccount: () => {
dispatch.facebook.getToken(dispatch.facebook.upgradeAccountWithToken);
},
login: () => {