How to use the @rematch/core.dispatch.user 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
compareDaily: async (props, { user }) => {
      const dailyVisits = await incrementDailyReward();

      if (dailyVisits !== user.dailyVisits) {
        // console.log('Yay! You came back, your streak is now at: ' + dailyVisits);

        dispatch.dailyStreak.set(dailyVisits);
        if (dailyVisits > user.dailyVisits) {
          dispatch.dailyStreak.rewardUser(dailyVisits);
        }
        dispatch.user.update({ dailyVisits });
        // / Give reward!
      } else {
        // console.log('ummmm', dailyVisits);
      }
    },
  },
github EvanBacon / pro-chat / client / src / rematch / auth.js View on Github external
authorized: (user) => {
      let _user = user;
      if (_user.toJSON) {
        _user = user.toJSON();
      }
      //   console.log('True User', _user);
      dispatch.user.update(_user);
    },
    logoutAsync: async () => {
github EvanBacon / pro-chat / client / src / rematch / user.js View on Github external
firebase.auth().onAuthStateChanged((auth) => {
        if (!auth) {
          // TODO: Evan: Y tho...
          dispatch.user.clear();
          // dispatch.user.signInAnonymously();
          NavigationService.navigate('Auth');
        } else {
          dispatch.user.getAsync();
          dispatch.popular.getAsync();
          Fire.shared.getMessageList();
          NavigationService.navigate('App');
          // dispatch.leaders.getAsync({ uid: user.uid });
        }
      });
    },
github EvanBacon / Expo-Pillar-Valley / client / src / rematch / models.js View on Github external
if (Settings.isCacheProfileUpdateActive) {
        const shouldUpdateKey = '@PillarValley/shouldUpdateProfile';
        const something = await getItemWithExpiration(shouldUpdateKey);
        if (!something) {
          const some = await setItemWithExpiration(
            shouldUpdateKey,
            { update: true },
            Settings.shouldDelayFirebaseProfileSyncInMinutes,
          );
          dispatch.user.syncLocalToFirebase();
        } else {
          console.log('Prevent: syncLocalToFirebase');
        }
      } else {
        dispatch.user.syncLocalToFirebase();
      }
    },
    mergeDataWithFirebase: async (props) => {
github EvanBacon / pro-chat / client / src / screens / SettingsScreen.js View on Github external
onSelectIndex={(index, searchRange) =>
              dispatch.user.updateUserProfile({ searchRange })
            }
github EvanBacon / pro-chat / client / src / screens / ProfileScreen.js View on Github external
rating,
      isMatched,
      image,
    });
    if (!uid) return null;

    if (this.isBlocked) {
      return ;
    }

    return (
      
    );
  };
github EvanBacon / pro-chat / client / src / screens / SettingsScreen.js View on Github external
this.setState({ notificationsEnabled }, _ =>
                dispatch.user.updateUserProfile({ notificationsEnabled }));
            }}