How to use the @rematch/core.dispatch.facebook function in @rematch/core

To help you get started, we’ve selected a few @rematch/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EvanBacon / Expo-Pillar-Valley / client / src / rematch / models.js View on Github external
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);
github EvanBacon / pro-chat / client / src / components / UpgradeAccountView.js View on Github external
_onPress = () => {
    dispatch.facebook.upgradeAccount();
  };
  _onLogout = () => {
github EvanBacon / Expo-Pillar-Valley / client / src / components / UpgradeAccountView.js View on Github external
_onPress = () => {
    dispatch.facebook.upgradeAccount();
  };
  _onLogout = () => {
github EvanBacon / Expo-Pillar-Valley / client / src / ExpoParty / Fire.js View on Github external
upgradeAccount = async () => {
    dispatch.facebook.upgradeAccount();
  };
github EvanBacon / Expo-Pillar-Valley / client / src / rematch / models.js View on Github external
upgradeAccount: () => {
      dispatch.facebook.getToken(dispatch.facebook.upgradeAccountWithToken);
    },
    login: () => {